flutter showdialog widget code example
Example 1: showdialog with builder flutter
showDialog(
context: context,
builder: (BuildContext context) => new AlertDialog(
title: new Text('Warning'),
content: new Text('Hi this is Flutter Alert Dialog'),
actions: <Widget>[
new IconButton(
icon: new Icon(Icons.close),
onPressed: () {
Navigator.pop(context);
})
],
));
Example 2: alertdialog flutter
showAlertDialog(BuildContext context) {
Widget okButton = FlatButton(
child: Text("OK"),
onPressed: () { },
);
AlertDialog alert = AlertDialog(
title: Text("My title"),
content: Text("This is my message."),
actions: [
okButton,
],
);
showDialog(
context: context,
builder: (BuildContext context) {
return alert;
},
);
}