[英]Dialog Box closes in Flutter
通過單擊后台加載的數據,我有一個“ 更新”按鈕 。
加載數據時,我顯示的是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),
),
);
},
);
}
好的,這很簡單,我只需要設置
barrierDismissible: false,
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.