From cbb26873e88a7a13e868448c1cc578ce70b8c6ae Mon Sep 17 00:00:00 2001
From: 905086 <k2049@qq.com>
Date: Mon, 09 Nov 2026 10:54:51 +0800
Subject: [PATCH] feat: 新增客户端版本管理与下载页,重构配置加载方式
---
fluttergamebox/lib/pages/main_shell.dart | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/fluttergamebox/lib/pages/main_shell.dart b/fluttergamebox/lib/pages/main_shell.dart
index b02184b..cbbac32 100644
--- a/fluttergamebox/lib/pages/main_shell.dart
+++ b/fluttergamebox/lib/pages/main_shell.dart
@@ -620,7 +620,7 @@
case '游戏恢复':
_showToast('游戏恢复功能:重新下载可恢复游戏文件');
case '重启应用':
- _showToast('应用重启中...');
+ _restartApp();
case '检查更新':
_showToast('当前已是最新版本!');
case '退出应用':
@@ -628,6 +628,21 @@
}
}
+ /// 重启应用:启动新的应用进程后退出当前进程
+ Future<void> _restartApp() async {
+ try {
+ // 以分离模式启动当前应用的 exe(带原有启动参数)
+ await Process.start(
+ Platform.resolvedExecutable,
+ Platform.executableArguments,
+ mode: ProcessStartMode.detached,
+ );
+ } catch (_) {
+ // 启动失败时仍尝试退出(下次手动打开)
+ }
+ exit(0);
+ }
+
void _showToast(String msg) {
final ctx = context;
// 使用全局 overlay 显示
--
Gitblit v1.10.0