How to dismiss an AlertDialog on a FlatButton click?

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

    Navigator.of(dialogContext).pop() otherwise you can close page if you navigated from Master to Detail page

                    showDialog(
                      context: context,
                      builder: (dialogContext) {
                        return Dialog(
                          child: Column(
                            children: [
                              Text("Content"),
                              RaisedButton(
                                onPressed: () => Navigator.of(dialogContext).pop(),
                                child: Text("Close"),
                              )
                            ],
                          ),
                        );
                      },
                    );
    

提交回复
热议问题