I agree with @youssef and @user17726418 answer, just adding extension to it if you are working with multiple states.
BlocBuilder<UploadPhotoBloc, UploadPhotoState>(
builder: (context, state) {
if (state is UploadPhotosLoading) {
return const LoadingButton();
}
return BlocBuilder<UserProfileBloc, UserProfileState>(
builder: (context, state) {
if (state is UserProfileLoading) {
return const LoadingButton();
} else {
return CustomButton(
title: 'Submit',
onTapCallBack: () async {
// your logic
},
),
}
})
}),