Flutter - SimpleDialog in FloatingActionButton
I noticed the accepted answer is using child
for showDialog
which is actually deprecated, so I would recommend avoiding it. You should be using builder
instead, I've provided an example:
onPressed: () {
showDialog(
context: context,
builder: (_) => AlertDialog(
title: Text('Dialog Title'),
content: Text('This is my content'),
)
);
}
You need to wrap this on a show action dialog.
showDialog(context: context, builder: (BuildContext context) {
return new AlertDialog(
title: new Text("My Super title"),
content: new Text("Hello World"),
);
}