diff --git a/packages/wyatt_bloc_helper/lib/src/bloc_base/bloc_base_consumer_screen.dart b/packages/wyatt_bloc_helper/lib/src/bloc_base/bloc_base_consumer_screen.dart index 0d5e3e96..3fc8e6e2 100644 --- a/packages/wyatt_bloc_helper/lib/src/bloc_base/bloc_base_consumer_screen.dart +++ b/packages/wyatt_bloc_helper/lib/src/bloc_base/bloc_base_consumer_screen.dart @@ -36,6 +36,11 @@ abstract class BlocBaseConsumerScreen, S extends Object> /// must return a widget. Widget onBuild(BuildContext context, S state); + /// The [onWrap] function which will be invoked on each widget build. + /// The [onWrap] takes the `BuildContext` + /// Used to wrap which depends on the state. + Widget onWrap(BuildContext context, Widget child) => child; + /// Takes the `BuildContext` along with the `state` /// and is responsible for executing in response to `state` changes. void onListen(BuildContext context, S state) {} @@ -45,6 +50,6 @@ abstract class BlocBaseConsumerScreen, S extends Object> listenWhen: shouldListenWhen, listener: onListen, buildWhen: shouldBuildWhen, - builder: onBuild, + builder: (context, state) => onWrap(context, onBuild(context, state)), ); }