Skip to content

Instantly share code, notes, and snippets.

@VB10
Last active December 7, 2020 22:11
Show Gist options
  • Save VB10/a96f006d0dbc4176c057398ff1dd8642 to your computer and use it in GitHub Desktop.
Save VB10/a96f006d0dbc4176c057398ff1dd8642 to your computer and use it in GitHub Desktop.
Widget buildScaffoldBody() => Scaffold(
key: scaffoldKey,
body: BlocConsumer<PointsCubit, PointsState>(
listener: (context, state) {
if (state.runtimeType == PointsError) {
scaffoldKey.currentState
.showSnackBar(SnackBar(content: Text("Error")));
}
},
builder: (context, state) {
switch (state.runtimeType) {
case PointsLoading:
return CircularProgressIndicator();
case PointsCompleted:
return pointAndPlaceView(state, context);
case PointsError:
return Text((state as PointsError).message);
default:
fetchPoints(context);
return CircularProgressIndicator();
}
},
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment