From c3315d968c26f93e640d27a8196dac7837857faf Mon Sep 17 00:00:00 2001 From: AN12345 Date: Thu, 24 Nov 2022 18:16:20 -0500 Subject: [PATCH] refactor(bloc_helper)!: update onWrap label (close #46) --- packages/wyatt_bloc_helper/README.md | 12 ++++++------ packages/wyatt_bloc_helper/lib/src/bloc.dart | 2 +- .../lib/src/bloc_base/bloc_base_consumer_screen.dart | 10 +++++----- packages/wyatt_bloc_helper/lib/src/cubit.dart | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/wyatt_bloc_helper/README.md b/packages/wyatt_bloc_helper/README.md index 9e18fc59..5b055eb4 100644 --- a/packages/wyatt_bloc_helper/README.md +++ b/packages/wyatt_bloc_helper/README.md @@ -1,17 +1,17 @@ @@ -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'), @@ -171,4 +171,4 @@ Widget onBuild(BuildContext context, CounterState state) { > Note: check **BlocProvider** and **BlocConsumer** documentation for more information. -You'll find a more examples in the `example/lib/counter/` directory. \ No newline at end of file +You'll find a more examples in the `example/lib/counter/` directory. diff --git a/packages/wyatt_bloc_helper/lib/src/bloc.dart b/packages/wyatt_bloc_helper/lib/src/bloc.dart index 7113c132..209a794a 100644 --- a/packages/wyatt_bloc_helper/lib/src/bloc.dart +++ b/packages/wyatt_bloc_helper/lib/src/bloc.dart @@ -62,7 +62,7 @@ abstract class BlocProviderScreen, /// [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, 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 13c25367..e413a206 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 @@ -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, @@ -51,10 +51,10 @@ abstract class BlocBaseConsumerScreen, /// [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, void onListen(BuildContext context, State state) {} @override - Widget build(BuildContext context) => onWrap( + Widget build(BuildContext context) => parent( context, BlocConsumer( listenWhen: shouldListenWhen, diff --git a/packages/wyatt_bloc_helper/lib/src/cubit.dart b/packages/wyatt_bloc_helper/lib/src/cubit.dart index 8f740a6e..b042b6a2 100644 --- a/packages/wyatt_bloc_helper/lib/src/cubit.dart +++ b/packages/wyatt_bloc_helper/lib/src/cubit.dart @@ -58,7 +58,7 @@ abstract class CubitProviderScreen, /// [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,