alroyso 1 year ago
parent
commit
3a56521f69
1 changed files with 4 additions and 2 deletions
  1. 4 2
      lib/app/controller/tray.dart

+ 4 - 2
lib/app/controller/tray.dart

@@ -15,7 +15,7 @@ class TrayController extends GetxController with TrayListener {
   var disabledTun = false.obs;
   var show = false.obs;
   var isSHow = false;
-
+  var isShowConsole = false.obs;
   Future<void> initTray() async {
     await trayManager.setIcon('assets/images/logo/logo.ico');
     // await trayManager.setTitle('Clash For Flutter');
@@ -96,7 +96,7 @@ class TrayController extends GetxController with TrayListener {
      // MenuItem(label: 'tray_about'.tr, onClick: handleClickAbout),
 
 
-      isSHow == true ?  MenuItem(label: "显示控制台", onClick: handleClickConsoleShow) : MenuItem(disabled: true,label: "显示控制台", onClick: handleClickConsoleShow),
+      isSHow == true ?  MenuItem(label: "显示控制台", onClick: handleClickConsoleShow,checked: isShowConsole.value) : MenuItem(disabled: true,label: "显示控制台", onClick: handleClickConsoleShow),
 
 
       MenuItem(label: 'tray_exit'.tr, onClick: handleClickExit),
@@ -121,8 +121,10 @@ class TrayController extends GetxController with TrayListener {
   Future<void> handleClickConsoleShow(MenuItem menuItem) async {
     isSHow = false;
     if (menuItem.checked == true) {
+      isShowConsole.value = true;
       showConsole();
     } else {
+      isShowConsole.value = false;
       hideConsole();
     }
   }