【发布时间】:2019-04-17 15:36:15
【问题描述】:
我有一个更新按钮,通过点击在后台加载的数据。
加载数据时,我会显示 AlertDialog,它会在加载数据时自动关闭。
但是,当数据正在加载时,如果用户单击屏幕上的其他位置,则对话框会关闭,这是不希望的。
问题是如何防止对话框关闭?
Future<void> _loadingDialog(String title) async {
return showDialog(
context: context,
barrierDismissible: true,
builder: (context) {
return AlertDialog(
title: Text(title),
content: LinearProgressIndicator(
backgroundColor: colorPrimaryLight,
valueColor: AlwaysStoppedAnimation<Color>(colorPrimaryDark),
),
);
},
);
}
【问题讨论】:
标签: dart flutter flutter-layout