Joã*_*ili 8 android-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..."),
),
],
),);
Run Code Online (Sandbox Code Playgroud)
但是,如果用户点击对话框外,它会关闭.因此,当auth完成时,它仍会弹出一些东西(我猜是脚手架),打破了应用程序.如何让Dialog不能关闭?
Vin*_*mar 20
里面有一个showDialog
叫做的房产barrierDismissible
.将此值设置为false将使您的AlertDialog无法通过单击外部关闭.
showDialog(
...
barrierDismissible: false,
...
Run Code Online (Sandbox Code Playgroud)
Cop*_*oad 11
为了防止按下后退按钮时关闭对话框,您还应该将您的AlertDialog
(或任何其他小部件)包装在WillPopScope
.
showDialog(
context: context,
barrierDismissible: false, // <-- Set this to false.
builder: (_) => WillPopScope(
onWillPop: () async => false, // <-- Prevents dialog dismiss on press of back button.
child: AlertDialog(...),
),
);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1979 次 |
最近记录: |