How to dismiss an AlertDialog on a FlatButton click?

前端 未结 16 1370
轮回少年
轮回少年 2021-02-03 16:44

I have the following AlertDialog.

showDialog(
            context: context,
            child: new AlertDialog(
              title: const Text(\"Lo         


        
16条回答
  •  面向向阳花
    2021-02-03 17:02

    Navigator.pop(_)
    

    worked for me, but the Flutter Team's gallery contains an example using:

    Navigator.of(context, rootNavigator: true).pop()
    

    which also works, and I am tempted to follow their lead.

提交回复
热议问题