Created
August 20, 2020 12:11
-
-
Save guilhermecarvalhocarneiro/0c53806cbc2b3e25af07633da0b215cb to your computer and use it in GitHub Desktop.
This file contains 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
BlocConsumer<UsuarioCubit, UsuarioState>( | |
listener: (context, state) { | |
if (state is UsuarioProcessState) { | |
FlutterToast(context).showToast( | |
child: Container( | |
color: Colors.blue[200], | |
width: double.infinity, | |
child: Column( | |
children: [ | |
LinearProgressIndicator(), | |
Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: Text("Carregando..."), | |
), | |
], | |
), | |
), | |
); | |
} | |
if (state is UsuarioErrorState) { | |
debugPrint(state.error); | |
} | |
if (state is UsuarioSuccessState) { | |
FlutterToast(context).showToast( | |
child: Container( | |
color: Colors.blue[200], | |
width: double.infinity, | |
child: Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: Text(state.successMessage), | |
), | |
), | |
); | |
} | |
}, | |
builder: (context, state) { | |
return Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Text( | |
'You have pushed the button this many times:', | |
), | |
Text( | |
'', | |
style: Theme.of(context).textTheme.headline4, | |
), | |
RaisedButton( | |
onPressed: () async { | |
context.bloc<UsuarioCubit>().fetchEscola(); | |
}, | |
child: Text("Carregar")) | |
], | |
); | |
}, | |
), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment