diff --git a/lib/application_exit_control.dart b/lib/application_exit_control.dart index 2ff49a3..d5e453b 100644 --- a/lib/application_exit_control.dart +++ b/lib/application_exit_control.dart @@ -41,18 +41,18 @@ class _ApplicationExitControlState extends State { // Uninstall tap device before exit final findTapResult = await Process.run( - "./tools/driver/devcon.exe", - ["hwids", "tap0901"], + './tools/driver/devcon.exe', + ['hwids', 'tap0901'], ); if (!findTapResult.stdout .toString() .contains('No matching devices found.')) { // Unstall tap device await Process.run( - "./tools/driver/devcon.exe", + './tools/driver/devcon.exe', [ - "remove", - "tap0901", + 'remove', + 'tap0901', ], ); } diff --git a/lib/control_page.dart b/lib/control_page.dart index fbff273..3285ddf 100644 --- a/lib/control_page.dart +++ b/lib/control_page.dart @@ -147,7 +147,7 @@ class _ControlPageState extends State { Navigator.pop(context); return; }, - child: const Text("保存")), + child: const Text('保存')), TextButton( onPressed: () { Navigator.pop(context); @@ -172,13 +172,13 @@ class _ControlPageState extends State { // Turn on firewall if (SharedPrefSingleton().autoFirewall) { await Process.run( - "netsh.exe", + 'netsh.exe', [ - "advfirewall", - "set", - "allprofiles", - "state", - "on", + 'advfirewall', + 'set', + 'allprofiles', + 'state', + 'on', ], ); } @@ -199,53 +199,53 @@ class _ControlPageState extends State { // Check for tap device final findTapResult = await Process.run( - "./tools/driver/devcon.exe", - ["hwids", "tap0901"], + './tools/driver/devcon.exe', + ['hwids', 'tap0901'], ); if (findTapResult.stdout .toString() .contains('No matching devices found.')) { // Install tap device EdgeState.instance.logger - .addLog("Tap device not found, installing tap"); - debugPrint("Tap device not found, installing tap"); + .addLog('Tap device not found, installing tap'); + debugPrint('Tap device not found, installing tap'); final installTapResult = await Process.run( - "./tools/driver/devcon.exe", + './tools/driver/devcon.exe', [ - "install", - "./tools/driver/OemVista.inf", - "tap0901", + 'install', + './tools/driver/OemVista.inf', + 'tap0901', ], ); if (installTapResult.stdout.toString().contains( - "Tap driver installed successfully.") || + 'Tap driver installed successfully.') || installTapResult.stdout.toString().contains( - "Drivers installed successfully.")) { + 'Drivers installed successfully.')) { EdgeState.instance.logger - .addLog("Tap driver installed successfully."); - debugPrint("Tap driver installed successfully."); + .addLog('Tap driver installed successfully.'); + debugPrint('Tap driver installed successfully.'); } else { EdgeState.instance.logger - .addLog("Tap driver install failed."); - debugPrint("Tap driver install failed."); + .addLog('Tap driver install failed.'); + debugPrint('Tap driver install failed.'); } } else { // Ignore. EdgeState.instance.logger - .addLog("Tap device already installed"); - debugPrint("Tap device already installed"); + .addLog('Tap device already installed'); + debugPrint('Tap device already installed'); } // Close firewall if (SharedPrefSingleton().autoFirewall) { await Process.run( - "netsh.exe", + 'netsh.exe', [ - "advfirewall", - "set", - "allprofiles", - "state", - "off", + 'advfirewall', + 'set', + 'allprofiles', + 'state', + 'off', ], ); } @@ -253,24 +253,24 @@ class _ControlPageState extends State { // Start the edge // edge -c -k -a -r -l Process.start( - "./tools/edge/edge.exe", + './tools/edge/edge.exe', [ - "-l", + '-l', _supernodeController.text, - "-c", + '-c', _communityController.text, - "-k", + '-k', _keyController.text, - "-a", + '-a', _selfAddressController.text, - "-r", + '-r', ], ).then((process) async { EdgeState.instance.isRunning = true; EdgeState.instance.process = process; EdgeState.instance.logger - .addLog("edge.exe starting"); - debugPrint("edge.exe starting"); + .addLog('edge.exe starting'); + debugPrint('edge.exe starting'); setState(() { _edgeConnecting = false; }); @@ -285,16 +285,16 @@ class _ControlPageState extends State { EdgeState.instance.isRunning = false; EdgeState.instance.process = null; EdgeState.instance.logger - .addLog("edge.exe closing"); - debugPrint("edge.exe closing"); + .addLog('edge.exe closing'); + debugPrint('edge.exe closing'); if (!mounted) return; setState(() {}); }); } }, child: EdgeState.instance.isRunning - ? const Text("断开连接") - : const Text("开始连接"), + ? const Text('断开连接') + : const Text('开始连接'), ), TextButton( onPressed: () { @@ -411,7 +411,7 @@ class _ControlPageState extends State { Navigator.pop(context); return; }, - child: const Text("取消"), + child: const Text('取消'), ), ], ), @@ -421,7 +421,7 @@ class _ControlPageState extends State { ), ); }, - child: const Text("使用配置")), + child: const Text('使用配置')), ], ), ), diff --git a/lib/home_page.dart b/lib/home_page.dart index 429d713..46521fa 100644 --- a/lib/home_page.dart +++ b/lib/home_page.dart @@ -27,7 +27,7 @@ class _HomePageState extends State { } // Must contain a default widget. - return const Text("Default"); + return const Text('Default'); } @override diff --git a/lib/setting_page.dart b/lib/setting_page.dart index 8a4e705..963c1dd 100644 --- a/lib/setting_page.dart +++ b/lib/setting_page.dart @@ -35,12 +35,12 @@ class _SettingPageState extends State { ..removeCurrentSnackBar() ..showSnackBar( const SnackBar( - content: Text("功能暂未开发, 敬请期待~"), + content: Text('功能暂未开发, 敬请期待~'), duration: Duration(seconds: 2), ), ); }, - child: const Text("检查更新"), + child: const Text('检查更新'), ), ], ); diff --git a/lib/shared_pref_singleton.dart b/lib/shared_pref_singleton.dart index 558c1f9..9e07401 100644 --- a/lib/shared_pref_singleton.dart +++ b/lib/shared_pref_singleton.dart @@ -9,14 +9,14 @@ class SharedPrefSingleton { _pref = await SharedPreferences.getInstance(); } - Future setAutoFirewall(bool ok) => _pref.setBool("auto_firewall", ok); - bool get autoFirewall => _pref.getBool("auto_firewall") ?? true; + Future setAutoFirewall(bool ok) => _pref.setBool('auto_firewall', ok); + bool get autoFirewall => _pref.getBool('auto_firewall') ?? true; - Future setAppTheme(bool ok) => _pref.setBool("app_theme", ok); + Future setAppTheme(bool ok) => _pref.setBool('app_theme', ok); // false = dark, true = light - bool get appTheme => _pref.getBool("app_theme") ?? false; + bool get appTheme => _pref.getBool('app_theme') ?? false; Future setSavedConnection(String config) => - _pref.setString("saved_connection", config); - String get savedConnection => _pref.getString("saved_connection") ?? "[]"; + _pref.setString('saved_connection', config); + String get savedConnection => _pref.getString('saved_connection') ?? '[]'; }