I have a dialog and I wrap it in a blocbuilder to update it according to the type of state but the dialog just is built First time and after state has changed it doesn't rebuild.
showDialog(
context: context,
builder: (_) {
BlocBuilder<ExampleCubit, ExampleState>(
bloc: cubit,
builder: (context, state) {
return CustomDialog(
title:"title",
onSave: (File file) {
cubit.uploadImage(file);
},
progress: (state is ExtendedExampleState)? state.progress:0,
onDelete: () {},
onCancel: () {
cubit.cancelUploading();
},
);
},
);
Note: It is important to use Bloc pattern rather StateFulBuilder
.
Example Cubit
andExample State
andCustom Dialog
. Current Information is not Enough – Hammons