Alert para confirmar cerrar Sesión Flutter
Edit mas opciones:
Alert Material
Comparto ejemplo
LogoutConfirm() {
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return Dialog(
elevation: 0.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
child: Container(
height: 135.0,
padding: EdgeInsets.all(20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
"Seguro que quieres cerrar sesión?",
style: blackBigTextStyle,
),
SizedBox(
height: 20.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
InkWell(
onTap: () {
Navigator.pop(context);
},
child: Container(
width: (width / 3.5),
alignment: Alignment.center,
padding: EdgeInsets.all(10.0),
decoration: BoxDecoration(
color: Colors.grey[300],
borderRadius: BorderRadius.circular(5.0),
),
child: Text(
'Cancelar',
style: blackColorButtonTextStyle,
),
),
),
InkWell(
onTap: () async {
SharedPreferences preferences =
await SharedPreferences.getInstance();
preferences.clear();
Provider.of<TaskData>(context, listen: false)
.clearOrderData();
Navigator.pop(context);
Navigator.pop(context);
},
child: Container(
width: (width / 3.5),
alignment: Alignment.center,
padding: EdgeInsets.all(10.0),
decoration: BoxDecoration(
color: primaryColor,
borderRadius: BorderRadius.circular(5.0),
),
child: Text(
'Cerrar Sesión',
style: whiteColorButtonTextStyle,
),
),
),
],
),
],
),
),
);
},
);
}
Comentarios
Publicar un comentario