我有以下 AlertDialog
。
showDialog(
context: context,
child: new AlertDialog(
title: const Text("Location disabled"),
content: const Text(
"""
Location is disabled on this device. Please enable it and try again.
"""),
actions: [
new FlatButton(
child: const Text("Ok"),
onPressed: _dismissDialog,
),
],
),
);
我怎样才能使 _dismissDialog()
驳回说 AlertDialog
?
原文由 Gustash 发布,翻译遵循 CC BY-SA 4.0 许可协议
Navigator.pop()
应该可以解决问题。您还可以使用它来返回对话框的结果(如果它为用户提供了选择)