alroyso 1 рік тому
батько
коміт
085173ee49

+ 8 - 1
lib/app/controller/GlobalController.dart

@@ -16,6 +16,7 @@ import 'package:shared_preferences/shared_preferences.dart';
 import 'package:tray_manager/tray_manager.dart';
 import 'package:window_manager/window_manager.dart';
 import 'package:path/path.dart' as path;
+import 'package:wl_base_help/wl_base_help.dart';
 import '../const/const.dart';
 
 class GlobalController extends GetxController {
@@ -35,7 +36,7 @@ class GlobalController extends GetxController {
   var systemProxySwitchIng = false.obs;
   var tunProxySwitchIng = false.obs;
   bool allowStatusUpdate = false;
-
+  final _wlBaseHelpPlugin = WlBaseHelp();
 
   final selectedNode = Rx<NodeMode?>(null);
   // 策略组
@@ -145,6 +146,12 @@ class GlobalController extends GetxController {
     }
   }
 
+  Future<void> showConsole() async {
+    await _wlBaseHelpPlugin.showConsole();
+  }
+  Future<void> hideConsole() async {
+    await _wlBaseHelpPlugin.hideConsole();
+  }
   Future<void> startSysMode() async {
 
     await makeProxy();

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

@@ -95,7 +95,8 @@ class TrayController extends GetxController with TrayListener {
      // MenuItem(label: 'tray_about'.tr, onClick: handleClickAbout),
 
 
-      //isSHow == true ?  MenuItem(label: "显示控制台", onClick: handleClickConsoleShow,checked: isShowConsole.value) : 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,10 +122,10 @@ class TrayController extends GetxController with TrayListener {
     isSHow = false;
     if (menuItem.checked == true) {
       isShowConsole.value = true;
-      //showConsole();
+      controllers.global.showConsole();
     } else {
       isShowConsole.value = false;
-     // hideConsole();
+      controllers.global.hideConsole();
     }
   }
   Future<void> handleClickShow(MenuItem menuItem) async {

+ 2 - 0
pubspec.yaml

@@ -35,6 +35,8 @@ dependencies:
   kommon: ^0.4.1
   bot_toast: ^4.1.3
   protocol_handler: ^0.1.2
+  wl_base_help:
+    path: ../wl_base_help
 
 
 dev_dependencies: