Last active
December 7, 2020 22:11
-
-
Save VB10/a96f006d0dbc4176c057398ff1dd8642 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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