refactor(bloc_helper): general code update
This commit is contained in:
@@ -41,12 +41,10 @@ abstract class BlocBaseConsumerScreen<B extends BlocBase<S>, S extends Object>
|
||||
void onListen(BuildContext context, S state) {}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocConsumer<B, S>(
|
||||
listenWhen: shouldListenWhen,
|
||||
listener: onListen,
|
||||
buildWhen: shouldBuildWhen,
|
||||
builder: onBuild,
|
||||
);
|
||||
}
|
||||
Widget build(BuildContext context) => BlocConsumer<B, S>(
|
||||
listenWhen: shouldListenWhen,
|
||||
listener: onListen,
|
||||
buildWhen: shouldBuildWhen,
|
||||
builder: onBuild,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -28,10 +28,8 @@ abstract class BlocBaseProviderScreen<B extends BlocBase<S>, S extends Object>
|
||||
Widget buildChild(BuildContext context);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider<B>(
|
||||
create: (_) => create(context),
|
||||
child: Builder(builder: buildChild),
|
||||
);
|
||||
}
|
||||
Widget build(BuildContext context) => BlocProvider<B>(
|
||||
create: (_) => create(context),
|
||||
child: Builder(builder: buildChild),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -26,10 +26,8 @@ abstract class BlocBaseScreen<B extends BlocBase<S>, S extends Object>
|
||||
B create(BuildContext context);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider<B>(
|
||||
create: (_) => create(context),
|
||||
child: super.build(context),
|
||||
);
|
||||
}
|
||||
Widget build(BuildContext context) => BlocProvider<B>(
|
||||
create: (_) => create(context),
|
||||
child: super.build(context),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user