Created
June 24, 2018 23:50
-
-
Save NilsBacke/160c5fce13d36f7ee244cb5dcd5520c1 to your computer and use it in GitHub Desktop.
An example of an alert dialog in flutter.
This file contains hidden or 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
// user defined function | |
void _showDialog() { | |
// flutter defined function | |
showDialog( | |
context: context, | |
builder: (BuildContext context) { | |
// return object of type Dialog | |
return AlertDialog( | |
title: new Text("Alert Dialog title"), | |
content: new Text("Alert Dialog body"), | |
actions: <Widget>[ | |
// usually buttons at the bottom of the dialog | |
new FlatButton( | |
child: new Text("Close"), | |
onPressed: () { | |
Navigator.of(context).pop(); | |
}, | |
), | |
], | |
); | |
}, | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment