v1.3.11: 全局更名为 EDC|易得; 更新下载屏幕常亮+防误触退出; 连线法向箭头+多线避让+平板拖动优化(线段拖动/磁吸虚线/抓取光标/实时预览)

This commit is contained in:
2026-10-11 22:40:57 +08:00
parent f42caa3657
commit e19dddf134
31 changed files with 877 additions and 185 deletions
+24 -5
View File
@@ -14,6 +14,7 @@ import 'package:flutter/services.dart';
import '../state/app_controller.dart';
import '../theme/tokens.dart';
import '../update/keep_awake.dart';
import '../update/update_service.dart';
import '../version.dart';
import 'dialogs.dart';
@@ -57,6 +58,8 @@ class _UpdateDialogState extends State<UpdateDialog> {
_received = 0;
_status = '正在下载更新包…';
});
// 下载期间保持屏幕常亮:避免锁屏中断下载(Android / Windows)。
await KeepAwake.enable();
try {
if (Platform.isAndroid) {
await _updateAndroid();
@@ -73,6 +76,8 @@ class _UpdateDialogState extends State<UpdateDialog> {
});
}
return;
} finally {
await KeepAwake.disable();
}
if (mounted) setState(() => _busy = false);
}
@@ -159,6 +164,7 @@ class _UpdateDialogState extends State<UpdateDialog> {
});
}
await Future<void>.delayed(const Duration(milliseconds: 900));
await KeepAwake.forceOff();
exit(0);
}
@@ -176,6 +182,13 @@ class _UpdateDialogState extends State<UpdateDialog> {
_cancelled = true;
}
@override
void dispose() {
// 兜底:对话框销毁后不再强制常亮。
KeepAwake.forceOff();
super.dispose();
}
@override
Widget build(BuildContext context) {
final Tokens t = context.tok;
@@ -183,10 +196,14 @@ class _UpdateDialogState extends State<UpdateDialog> {
final String sizeText = info.assetSize > 0
? '${(info.assetSize / 1048576).toStringAsFixed(1)} MB'
: '';
return Dialog(
backgroundColor: t.dialog,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
child: scaledDialogBox(
return PopScope(
// 下载中禁止返回键退出;未下载时可返回键关闭。
// 点击对话框外的灰色区域始终无响应(barrierDismissible: false)。
canPop: !_busy,
child: Dialog(
backgroundColor: t.dialog,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
child: scaledDialogBox(
context,
620,
560,
@@ -300,7 +317,8 @@ class _UpdateDialogState extends State<UpdateDialog> {
const SizedBox(width: 8),
Expanded(
child: Text(
'下载更新过程中,请确保屏幕保持长亮、网络持续连接,避免更新包下载中断。',
'更新过程中软件会自动保持屏幕常亮;请保持界面打开、网络连接稳定,'
'不要退出软件,避免更新包下载中断。',
style: TextStyle(color: t.warn, fontSize: 11.5, height: 1.5),
),
),
@@ -343,6 +361,7 @@ class _UpdateDialogState extends State<UpdateDialog> {
),
),
),
),
);
}
}