From b1e9aef9d2698cf27eccde2f131eae3c4e6a65d0 Mon Sep 17 00:00:00 2001
From: 905086 <k2049@qq.com>
Date: Sun, 08 Nov 2026 16:10:17 +0800
Subject: [PATCH] docs: 添加项目信息和游戏功能需求文档

---
 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