如何将AlertDialog设置为不关闭并在颤动中单击外部 [英] How to set AlertDialog to don't close clicking outside in flutter
本文介绍了如何将AlertDialog设置为不关闭并在颤动中单击外部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我建立了一个AlertDialog,以在验证用户身份时显示正在加载",并在完成时弹出它.
I built an AlertDialog to display Loading while i'm authenticating the user and when it finishes i pop it.
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无法关闭?
But, if the user taps outside the Dialog it closes. So when the auth finishes, it will still pop something (i guess the scaffol), breaking the app. How can i make Dialog not closable?
推荐答案
showDialog
中有一个名为barrierDismissible
的属性.将此值设置为false将使您的AlertDialog无法通过单击外部关闭.
There is a property inside showDialog
called barrierDismissible
. Setting this value to false will make your AlertDialog not closable by clicking outside.
showDialog(
...
barrierDismissible: false,
...
这篇关于如何将AlertDialog设置为不关闭并在颤动中单击外部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文