How to dismiss an AlertDialog on a FlatButton click?

前端 未结 16 1293
轮回少年
轮回少年 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:15

    This answer works if you want to pop the dialog and navigate to another view. This part 'current_user_location' is the string the router need to know which view to navigate to.

    FlatButton(
               child: Text('NO'),
               onPressed: () {
                 Navigator.popAndPushNamed(context, 'current_user_location');
                  },
               ),
    

提交回复
热议问题