本文介绍了如何在FlatButton单击时关闭AlertDialog?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下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
?
推荐答案
应该可以解决问题.您还可以使用它返回对话框的结果(如果对话框为用户提供了选择)
Navigator.pop()
should do the trick. You can also use that to return the result of the dialog (if it presented the user with choices)
这篇关于如何在FlatButton单击时关闭AlertDialog?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!