解散Cupertino对话行动Flutter

时间:2018-04-02 12:33:58

标签: ios dart alertdialog flutter

在使用解释的方法解雇呈现的Cupertino警报对话动作时,我的整个屏幕都会弹出并且警报对话保留在屏幕上。这是我的代码。

if (deviceList.isEmpty){

      var alert = new CupertinoAlertDialog(
        title: new Text("Alert"),
        content: new Text("There was an error signing in. Please try again."),
        actions: <Widget>[
          new CupertinoDialogAction(
              child: const Text('Discard'),
              isDestructiveAction: true,
              onPressed: () { Navigator.pop(context, 'Discard'); }
          ),
          new CupertinoDialogAction(
              child: const Text('Cancel'),
              isDefaultAction: true,
              onPressed: () { Navigator.pop(context, 'Cancel'); }
          ),
        ],
      );
      showDialog(context: context, child: alert);
    }

我在做什么有什么不对吗?我找不到任何其他解决方案来解雇警报对话。请帮忙。

1 个答案:

答案 0 :(得分:6)

在这种情况下,您需要指定of()Navigator.of(context, rootNavigator: true).pop("Discard");

public string StringConcat(string param0, string param1) { return param0 + param1; }

检查the implementation proposed in the documentation