如何将AlertDialog设置为不关闭并在Flutter中单击外部
问题内容:
我建立了一个AlertDialog,以在验证用户身份时显示“正在加载”,并在完成时弹出它。
Widget loadingDialog = new AlertDialog(
content: new Row(
children: <Widget>[
new CircularProgressIndicator(),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text("Loading..."),
),
],
),);
但是,如果用户在对话框外部点击,它将关闭。因此,当身份验证完成后,它仍会弹出一些内容(我猜是scaffol),破坏了应用程序。如何使Dialog无法关闭?
问题答案:
内部有一个showDialog
名为的属性barrierDismissible
。将此值设置为false将使您的AlertDialog无法通过单击外部关闭。
showDialog(
...
barrierDismissible: false,
...