首页 文章

如何解除扑动对话?

提问于
浏览
2

我是新手,我想在任务完成后解雇我的对话框 . 我尝试过:

Navigator.pop(context, true);

但是我的屏幕变黑了,对话框还在那里 . 这是我的对话框代码 .

Dialog _dialog = new Dialog(
  child: new Row(
    mainAxisSize: MainAsixSize.min, 
    children: <Widget> [
    new CircularProgressIndicator(), 
    new Text("Loading")]),     

);

1 回答

  • 1

    https://docs.flutter.io/flutter/material/showDialog.html

    此方法创建的对话框路径将推送到根导航器 . 如果应用程序有多个Navigator对象,则可能需要调用Navigator.of(context,rootNavigator:true).pop(result)来关闭对话框,而不仅仅是Navigator.pop(context,result) .

    所以我假设这两个中的一个应该做你想要的 .

相关问题