I know Stack
Widgets render their children from the ground up, however, I couldn't explain to myself why a BlocBuilder
cannot efficiently rebuild them.
Here is an example:
@override
Widget build(BuildContext context) {
return Container(
child: BlocBuilder<TestCubit, int>(
builder: (context, state) {
return GestureDetector(
onTapDown: (tapDetails) {
context.read<TestCubit>().incrementCubit();
},
child: Stack(children: [Text('Counter: $state')]),
);
},
)
);
}
When TestCubit
has its incrementCubit
method called, the state changes - I tested it with a simple Container
based UI, but once we are dealing with a Stack, nothing happens on the screen. Any ideas?
Thanks in advance!