|
|
|
@ -4,7 +4,7 @@ import 'package:get/get.dart'; |
|
|
|
import '../../../data/models/channel_app_model.dart'; |
|
|
|
import '../../../data/services/version_update_service.dart'; |
|
|
|
|
|
|
|
/// 版本更新提示对话框 |
|
|
|
/// 版本更新提示对话框 - 禁止外部关闭 |
|
|
|
class VersionUpdateDialog extends StatelessWidget { |
|
|
|
final VersionUpdateInfo updateInfo; |
|
|
|
final VoidCallback? onCancel; |
|
|
|
@ -21,7 +21,23 @@ class VersionUpdateDialog extends StatelessWidget { |
|
|
|
Widget build(BuildContext context) { |
|
|
|
final isDarkMode = Theme.of(context).brightness == Brightness.dark; |
|
|
|
|
|
|
|
// 在强制更新时添加拦截层 |
|
|
|
Widget dialogContent = _buildDialogContent(isDarkMode); |
|
|
|
//if (updateInfo.updateType == UpdateType.force) { |
|
|
|
return PopScope( |
|
|
|
canPop: false, // 完全禁用返回键关闭 |
|
|
|
child: dialogContent, |
|
|
|
); |
|
|
|
//} |
|
|
|
|
|
|
|
//return dialogContent; |
|
|
|
} |
|
|
|
|
|
|
|
/// 构建对话框内容 |
|
|
|
Widget _buildDialogContent(bool isDarkMode) { |
|
|
|
return Dialog( |
|
|
|
// 关键修改:禁用外部点击关闭 |
|
|
|
//barrierDismissible: false, |
|
|
|
shape: RoundedRectangleBorder( |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
), |
|
|
|
@ -112,7 +128,9 @@ class VersionUpdateDialog extends StatelessWidget { |
|
|
|
shape: RoundedRectangleBorder( |
|
|
|
borderRadius: BorderRadius.circular(8.r), |
|
|
|
side: BorderSide( |
|
|
|
color: isDarkMode ? Colors.grey[600]! : Colors.grey[300]!, |
|
|
|
color: isDarkMode |
|
|
|
? Colors.grey[600]! |
|
|
|
: Colors.grey[300]!, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
@ -120,7 +138,8 @@ class VersionUpdateDialog extends StatelessWidget { |
|
|
|
'稍后提醒', |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 16.sp, |
|
|
|
color: isDarkMode ? Colors.grey[400] : Colors.grey[600], |
|
|
|
color: |
|
|
|
isDarkMode ? Colors.grey[400] : Colors.grey[600], |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
@ -220,7 +239,10 @@ class VersionUpdateDialog extends StatelessWidget { |
|
|
|
static Future<void> show(VersionUpdateInfo updateInfo) async { |
|
|
|
await Get.dialog( |
|
|
|
VersionUpdateDialog(updateInfo: updateInfo), |
|
|
|
barrierDismissible: updateInfo.updateType != UpdateType.force, |
|
|
|
// 关键修改:禁用外部点击关闭 |
|
|
|
barrierDismissible: false, |
|
|
|
// 防止返回键关闭(在强制更新模式下) |
|
|
|
//useRootNavigator: true, |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|