Want to open flutter dialog after navigation? You can call the dialog from inside ‘initState()’ dalaying its appearance after the first frame has been drawn.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | @override void initState() { super.initState(); WidgetsBinding.instance.addPostFrameCallback((_) async { await showDialog<String>( context: context, builder: (BuildContext context) => new AlertDialog( title: new Text("title"), content: new Text("Message"), actions: <Widget>[ new FlatButton( child: new Text("OK"), onPressed: () { Navigator.of(context).pop(); }, ), ], ), ); }); } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.