refactor(bloc_helper)!: update onWrap label (close #46) #52
| @ -116,11 +116,11 @@ Widget onBuild(BuildContext context, CounterState state) { | ||||
| } | ||||
| ``` | ||||
| 
 | ||||
| If needed, you can wrap what depends on the state with the function `onWrap`. | ||||
| If needed, you can wrap what depends on the state with the function `parent`. | ||||
| 
 | ||||
| ```dart | ||||
| @override | ||||
| Widget onWrap(BuildContext context, Widget child) { | ||||
| Widget parent(BuildContext context, Widget child) { | ||||
|     return Scaffold( | ||||
|         appBar: AppBar( | ||||
|             title: const Text('Title'), | ||||
|  | ||||
| @ -62,7 +62,7 @@ abstract class BlocProviderScreen<Bloc extends blocbase.Bloc<Event, State>, | ||||
| /// [shouldListenWhen] and [shouldBuildWhen] are optional and if they | ||||
| /// aren't implemented, they will default to `true`. | ||||
| /// | ||||
| /// An optional [onWrap] can also be implemented. This build a wrapper arround | ||||
| /// An optional [parent] can also be implemented. This build a wrapper arround | ||||
| /// the built BlocConsumer that is **not** rebuild on each state. | ||||
| /// {@endtemplate} | ||||
| abstract class BlocConsumerScreen<Bloc extends blocbase.Bloc<Event, State>, | ||||
|  | ||||
| @ -33,7 +33,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; | ||||
| /// [shouldListenWhen] and [shouldBuildWhen] are optional and if they | ||||
| /// aren't implemented, they will default to `true`. | ||||
| /// | ||||
| /// An optional [onWrap] can also be implemented. This build a wrapper arround | ||||
| /// An optional [parent] can also be implemented. This build a wrapper arround | ||||
| /// the built [BlocConsumer] that is **not** rebuild on each state. | ||||
| /// {@endtemplate} | ||||
| abstract class BlocBaseConsumerScreen<Bloc extends BlocBase<State>, | ||||
| @ -51,10 +51,10 @@ abstract class BlocBaseConsumerScreen<Bloc extends BlocBase<State>, | ||||
|   /// [onListen] with the current `state`. | ||||
|   bool shouldListenWhen(State previous, State current) => true; | ||||
| 
 | ||||
|   /// The [onWrap] function which will be invoked on build. | ||||
|   /// The [onWrap] takes a `BuildContext` that **doesn't have** access | ||||
|   /// The [parent] function which will be invoked on build. | ||||
|   /// The [parent] takes a `BuildContext` that **doesn't have** access | ||||
|   /// to the [Bloc] or [Cubit]. | ||||
|   Widget onWrap(BuildContext context, Widget child) => child; | ||||
|   Widget parent(BuildContext context, Widget child) => child; | ||||
| 
 | ||||
|   /// The [onBuild] function which will be invoked on each widget build. | ||||
|   /// The [onBuild] takes the `BuildContext` and current `state` and | ||||
| @ -66,7 +66,7 @@ abstract class BlocBaseConsumerScreen<Bloc extends BlocBase<State>, | ||||
|   void onListen(BuildContext context, State state) {} | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) => onWrap( | ||||
|   Widget build(BuildContext context) => parent( | ||||
|         context, | ||||
|         BlocConsumer<Bloc, State>( | ||||
|           listenWhen: shouldListenWhen, | ||||
|  | ||||
| @ -58,7 +58,7 @@ abstract class CubitProviderScreen<Cubit extends blocbase.Cubit<State>, | ||||
| /// [shouldListenWhen] and [shouldBuildWhen] are optional and if they | ||||
| /// aren't implemented, they will default to `true`. | ||||
| /// | ||||
| /// An optional [onWrap] can also be implemented. This build a wrapper arround | ||||
| /// An optional [parent] can also be implemented. This build a wrapper arround | ||||
| /// the built BlocConsumer that is **not** rebuild on each state. | ||||
| /// {@endtemplate} | ||||
| abstract class CubitConsumerScreen<Cubit extends blocbase.Cubit<State>, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user