Recabamos por distintos sitios para brindarte la solución para tu inquietud, en caso de preguntas puedes dejar tu inquietud y contestaremos con gusto, porque estamos para ayudarte.
Ejemplo 1: barra de aperitivos flutter que muestra un error
You can show material design snackbars using the following code:
Scaffold.of(context).showSnackBar(SnackBar(
content:Text("New Notification"),));
In some cases,this will throw an error and it can be resolved using a workaround://Declare a GlobalKey
GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();//Assing this key to the scaffoldScaffold(
key: _scaffoldKey,
body:...)//finally in the topmost code use this key in the following way
_scaffoldKey.showSnackBar(SnackBar(
content:Text("New Notification"),));
Ejemplo 2: cómo mostrar snackbar en flutter
You can show material design snackbars using the following code:
Scaffold.of(context).showSnackBar(SnackBar(
content:Text("New Notification"),));
In some cases,this will throw an error and it can be resolved using a workaround://Declare a GlobalKey
GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();//Assing this key to the scaffoldScaffold(
key: _scaffoldKey,
body:...)//finally in the topmost code use this key in the following way
_scaffoldKey.showSnackBar(SnackBar(
content:Text("New Notification"),));
Ejemplo 3: parte superior de la barra de aperitivos Flutter
RaisedButton(
child:Text('Show Top Snackbar'),
onPressed:()Flushbar(
flushbarPosition: FlushbarPosition.TOP,)..title ="Hey Ninja"..message ="Lorem Ipsum is simply dummy text of the printing and typesetting industry"..duration =Duration(seconds:3)..show(context);,),
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)