xxxxxxxxxx
showCupertinoDialog(
context: context,
builder: (BuildContext context) =>
CupertinoAlertDialog(
content: Text(
'Hiiii You are Welcome'),
actions: <Widget>[
CupertinoButton(
child: Text('Okay'),
onPressed: () {
Navigator.pop(context);
})
],
));
xxxxxxxxxx
AlertDialog(
title: const Text('AlertDialog Title'),
content: const Text('this is a demo alert diolog'),
actions: <Widget>[
TextButton(
child: const Text('Approve'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
xxxxxxxxxx
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(32.0))),
xxxxxxxxxx
showAlertDialog(BuildContext context) {
// set up the button
Widget okButton = FlatButton(
child: Text("OK"),
onPressed: () { },
);
// set up the AlertDialog
AlertDialog alert = AlertDialog(
title: Text("My title"),
content: Text("This is my message."),
actions: [
okButton,
],
);
// show the dialog
showDialog(
context: context,
builder: (BuildContext context) {
return alert;
},
);
}
xxxxxxxxxx
showDialog(
context: context,
child: new AlertDialog(
title: const Text("Location disabled"),
content: const Text(
"""
Location is disabled on this device. Please enable it and try again.
"""),
actions: [
new FlatButton(
child: const Text("Ok"),
onPressed: _dismissDialog,
),
],
),
);