diff --git a/.dart_tool/flutter_gen/gen_l10n/l10n.dart b/.dart_tool/flutter_gen/gen_l10n/l10n.dart index 9f5416c0..fcbd77f2 100644 --- a/.dart_tool/flutter_gen/gen_l10n/l10n.dart +++ b/.dart_tool/flutter_gen/gen_l10n/l10n.dart @@ -956,11 +956,11 @@ abstract class S { /// **'Preview'** String get preview; - /// No description provided for @primaryColor. + /// No description provided for @primaryColorSeed. /// /// In en, this message translates to: - /// **'Primary color'** - String get primaryColor; + /// **'Primary color seed'** + String get primaryColorSeed; /// No description provided for @privateKey. /// diff --git a/.dart_tool/flutter_gen/gen_l10n/l10n_de.dart b/.dart_tool/flutter_gen/gen_l10n/l10n_de.dart index fbc2617a..3e36d1ec 100644 --- a/.dart_tool/flutter_gen/gen_l10n/l10n_de.dart +++ b/.dart_tool/flutter_gen/gen_l10n/l10n_de.dart @@ -456,7 +456,7 @@ class SDe extends S { String get preview => 'Vorschau'; @override - String get primaryColor => 'Farbschema'; + String get primaryColorSeed => 'Farbschema'; @override String get privateKey => 'Private Key'; diff --git a/.dart_tool/flutter_gen/gen_l10n/l10n_en.dart b/.dart_tool/flutter_gen/gen_l10n/l10n_en.dart index 51ebc6bb..1303f75d 100644 --- a/.dart_tool/flutter_gen/gen_l10n/l10n_en.dart +++ b/.dart_tool/flutter_gen/gen_l10n/l10n_en.dart @@ -456,7 +456,7 @@ class SEn extends S { String get preview => 'Preview'; @override - String get primaryColor => 'Primary color'; + String get primaryColorSeed => 'Primary color seed'; @override String get privateKey => 'Private Key'; diff --git a/.dart_tool/flutter_gen/gen_l10n/l10n_id.dart b/.dart_tool/flutter_gen/gen_l10n/l10n_id.dart index 4c3b4353..83a2df38 100644 --- a/.dart_tool/flutter_gen/gen_l10n/l10n_id.dart +++ b/.dart_tool/flutter_gen/gen_l10n/l10n_id.dart @@ -456,7 +456,7 @@ class SId extends S { String get preview => 'Pratinjau'; @override - String get primaryColor => 'Warna utama'; + String get primaryColorSeed => 'Warna utama'; @override String get privateKey => 'Kunci Pribadi'; diff --git a/.dart_tool/flutter_gen/gen_l10n/l10n_zh.dart b/.dart_tool/flutter_gen/gen_l10n/l10n_zh.dart index f55c5556..7fc93c25 100644 --- a/.dart_tool/flutter_gen/gen_l10n/l10n_zh.dart +++ b/.dart_tool/flutter_gen/gen_l10n/l10n_zh.dart @@ -456,7 +456,7 @@ class SZh extends S { String get preview => '预览'; @override - String get primaryColor => '主题色'; + String get primaryColorSeed => '主题色种子'; @override String get privateKey => '私钥'; @@ -1155,7 +1155,7 @@ class SZhTw extends SZh { String get preview => '預覽'; @override - String get primaryColor => '主要色調'; + String get primaryColorSeed => '主要色調種子'; @override String get privateKey => '私鑰'; diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 8e64e1fc..673e44d3 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -470,7 +470,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 473; + CURRENT_PROJECT_VERSION = 474; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -478,7 +478,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.473; + MARKETING_VERSION = 1.0.474; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -602,7 +602,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 473; + CURRENT_PROJECT_VERSION = 474; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -610,7 +610,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.473; + MARKETING_VERSION = 1.0.474; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -628,7 +628,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 473; + CURRENT_PROJECT_VERSION = 474; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -636,7 +636,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.473; + MARKETING_VERSION = 1.0.474; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -657,7 +657,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 473; + CURRENT_PROJECT_VERSION = 474; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -670,7 +670,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.473; + MARKETING_VERSION = 1.0.474; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; @@ -696,7 +696,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 473; + CURRENT_PROJECT_VERSION = 474; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -709,7 +709,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.473; + MARKETING_VERSION = 1.0.474; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -732,7 +732,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 473; + CURRENT_PROJECT_VERSION = 474; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -745,7 +745,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.473; + MARKETING_VERSION = 1.0.474; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/lib/data/res/build_data.dart b/lib/data/res/build_data.dart index 7eb90e4f..2e8337ab 100644 --- a/lib/data/res/build_data.dart +++ b/lib/data/res/build_data.dart @@ -2,8 +2,8 @@ class BuildData { static const String name = "ServerBox"; - static const int build = 473; + static const int build = 474; static const String engine = "3.10.6"; - static const String buildAt = "2023-08-15 23:06:31.430481"; - static const int modifications = 2; + static const String buildAt = "2023-08-16 15:42:48.857532"; + static const int modifications = 24; } diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 29aa28b4..537520f8 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -143,7 +143,7 @@ "plzSelectKey": "Wähle einen Key.", "port": "Port", "preview": "Vorschau", - "primaryColor": "Farbschema", + "primaryColorSeed": "Farbschema", "privateKey": "Private Key", "process": "Prozess", "pushToken": "Push Token", diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index af0b1a01..98b6d8e4 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -143,7 +143,7 @@ "plzSelectKey": "Please select a key.", "port": "Port", "preview": "Preview", - "primaryColor": "Primary color", + "primaryColorSeed": "Primary color seed", "privateKey": "Private Key", "process": "Process", "pushToken": "Push token", diff --git a/lib/l10n/app_id.arb b/lib/l10n/app_id.arb index fee6473c..1350961c 100644 --- a/lib/l10n/app_id.arb +++ b/lib/l10n/app_id.arb @@ -143,7 +143,7 @@ "plzSelectKey": "Pilih kunci.", "port": "Port", "preview": "Pratinjau", - "primaryColor": "Warna utama", + "primaryColorSeed": "Warna utama", "privateKey": "Kunci Pribadi", "process": "Proses", "pushToken": "Dorong token", diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index 25c89d50..cfca9a57 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -143,7 +143,7 @@ "plzSelectKey": "请选择私钥", "port": "端口", "preview": "预览", - "primaryColor": "主题色", + "primaryColorSeed": "主题色种子", "privateKey": "私钥", "process": "进程", "pushToken": "消息推送 Token", diff --git a/lib/l10n/app_zh_tw.arb b/lib/l10n/app_zh_tw.arb index c72523ab..517896e3 100644 --- a/lib/l10n/app_zh_tw.arb +++ b/lib/l10n/app_zh_tw.arb @@ -143,7 +143,7 @@ "plzSelectKey": "請選擇私鑰", "port": "端口", "preview": "預覽", - "primaryColor": "主要色調", + "primaryColorSeed": "主要色調種子", "privateKey": "私鑰", "process": "進程", "pushToken": "消息推送 Token", diff --git a/lib/view/page/server/detail.dart b/lib/view/page/server/detail.dart index be2696a0..bcf85411 100644 --- a/lib/view/page/server/detail.dart +++ b/lib/view/page/server/detail.dart @@ -437,10 +437,12 @@ class _ServerDetailPageState extends State ), ], ))); - return RoundRectCard(Padding( - padding: roundRectCardPadding, - child: Column(children: children), - ),); + return RoundRectCard( + Padding( + padding: roundRectCardPadding, + child: Column(children: children), + ), + ); } Widget _buildAnimatedText(Key key, String text, TextStyle style) { diff --git a/lib/view/page/setting.dart b/lib/view/page/setting.dart index 177c420b..58aa5120 100644 --- a/lib/view/page/setting.dart +++ b/lib/view/page/setting.dart @@ -274,14 +274,12 @@ class _SettingPageState extends State { width: 27, ), ), - title: Text( - _s.primaryColor, - ), + title: Text(_s.primaryColorSeed), onTap: () async { final ctrl = TextEditingController(text: primaryColor.toHex); await showRoundDialog( context: context, - title: Text(_s.primaryColor), + title: Text(_s.primaryColorSeed), child: Input( onSubmitted: _onSaveColor, controller: ctrl, @@ -674,7 +672,7 @@ class _SettingPageState extends State { }, ).toList(); return ListTile( - title: Text(_s.light + _s.theme), + title: Text('${_s.light} ${_s.theme.toLowerCase()}'), trailing: ValueBuilder( listenable: _editorTheme, build: () => PopupMenuButton( @@ -707,7 +705,7 @@ class _SettingPageState extends State { }, ).toList(); return ListTile( - title: Text(_s.dark + _s.theme), + title: Text('${_s.dark} ${_s.theme.toLowerCase()}'), trailing: ValueBuilder( listenable: _editorDarkTheme, build: () => PopupMenuButton( diff --git a/lib/view/page/ssh/term.dart b/lib/view/page/ssh/term.dart index 6b20d0d3..c47ea4c6 100644 --- a/lib/view/page/ssh/term.dart +++ b/lib/view/page/ssh/term.dart @@ -40,7 +40,6 @@ class _SSHPageState extends State { final _setting = locator(); late final _terminal = Terminal(inputHandler: _keyboard); final TerminalController _terminalController = TerminalController(); - final ContextMenuController _menuController = ContextMenuController(); final List> _virtKeysList = []; late MediaQueryData _media; @@ -48,13 +47,13 @@ class _SSHPageState extends State { late TerminalStyle _terminalStyle; late TerminalTheme _terminalTheme; late TextInputType _keyboardType; - late SSHSession _session; late double _virtKeyWidth; late double _virtKeysHeight; bool _isDark = false; Timer? _virtKeyLongPressTimer; SSHClient? _client; + SSHSession? _session; @override void initState() { @@ -76,10 +75,7 @@ class _SSHPageState extends State { _virtKeyLongPressTimer?.cancel(); _terminalController.dispose(); _client?.close(); - // ignore: unnecessary_null_comparison - if (_session != null) { - _session.close(); - } + _session?.close(); } @override @@ -116,16 +112,18 @@ class _SSHPageState extends State { _virtKeysHeight - _media.padding.bottom - _media.padding.top, - child: TerminalView( - _terminal, - onTapUp: _onTapUp, - controller: _terminalController, - keyboardType: _keyboardType, - textStyle: _terminalStyle, - theme: _terminalTheme, - deleteDetection: isIOS, - autofocus: true, - keyboardAppearance: _isDark ? Brightness.dark : Brightness.light, + child: Padding( + padding: EdgeInsets.only(top: _media.padding.top), + child: TerminalView( + _terminal, + controller: _terminalController, + keyboardType: _keyboardType, + textStyle: _terminalStyle, + theme: _terminalTheme, + deleteDetection: isIOS, + autofocus: true, + keyboardAppearance: _isDark ? Brightness.dark : Brightness.light, + ), ), ); } @@ -268,13 +266,8 @@ class _SSHPageState extends State { ); return; } - AppRoute( - SftpPage( - widget.spi, - initPath: initPath, - ), - 'SSH SFTP') - .go(context); + final page = SftpPage(widget.spi, initPath: initPath); + AppRoute(page, 'SSH SFTP').go(context); } } @@ -338,76 +331,42 @@ class _SSHPageState extends State { ), ); + if (_session == null) { + showSnackBar(context, const Text('Null session')); + return; + } + _terminal.buffer.clear(); _terminal.buffer.setCursor(0, 0); _terminal.onOutput = (data) { - _session.write(utf8.encode(data) as Uint8List); + _session?.write(utf8.encode(data) as Uint8List); + }; + _terminal.onResize = (width, height, pixelWidth, pixelHeight) { + _session?.resizeTerminal(width, height); }; - _listen(_session.stdout); - _listen(_session.stderr); + _listen(_session?.stdout); + _listen(_session?.stderr); if (widget.initCmd != null) { _terminal.textInput(widget.initCmd!); _terminal.keyInput(TerminalKey.enter); } - await _session.done; + await _session?.done; if (mounted) { context.pop(); } } - void _listen(Stream stream) { + void _listen(Stream? stream) { + if (stream == null) { + return; + } stream .cast>() .transform(const Utf8Decoder()) .listen(_terminal.write); } - - void _onTapUp(TapUpDetails details, CellOffset offset) { - if (_menuController.isShown) { - _menuController.remove(); - return; - } - final selected = terminalSelected; - final children = [ - // TextButton( - // onPressed: () { - // _paste(); - // }, - // child: Text(_s.paste), - // ), - ]; - if (selected?.trim().isNotEmpty ?? false) { - children.add( - TextButton( - child: Text( - _s.copy, - ), - onPressed: () { - _terminalController.setSelection(CellAnchor(0), CellAnchor(0)); - if (selected != null) { - copy2Clipboard(selected); - } - _menuController.remove(); - }, - ), - ); - } - if (children.isEmpty) { - return; - } - _menuController.show( - context: context, - contextMenuBuilder: (context) { - return TextSelectionToolbar( - anchorAbove: details.globalPosition, - anchorBelow: details.globalPosition, - children: children, - ); - }, - ); - } } diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index 0784611c..d027985a 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -475,9 +475,9 @@ baseConfigurationReference = C1C758C41C4E208965A68933 /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 473; + CURRENT_PROJECT_VERSION = 474; GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0.473; + MARKETING_VERSION = 1.0.474; PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -490,9 +490,9 @@ baseConfigurationReference = 15AF97DF993E8968098D6EBE /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 473; + CURRENT_PROJECT_VERSION = 474; GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0.473; + MARKETING_VERSION = 1.0.474; PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -505,9 +505,9 @@ baseConfigurationReference = 7CFA7DE7FABA75685DFB6948 /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 473; + CURRENT_PROJECT_VERSION = 474; GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0.473; + MARKETING_VERSION = 1.0.474; PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; diff --git a/pubspec.lock b/pubspec.lock index 2d499f77..d22277f9 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1038,9 +1038,11 @@ packages: xterm: dependency: "direct main" description: - path: "../xterm.dart" - relative: true - source: path + path: "." + ref: master + resolved-ref: "937c25f58904432a4eb478a8b7f81bc012d20027" + url: "https://github.com/lollipopkit/xterm.dart" + source: git version: "3.6.1-pre" yaml: dependency: transitive diff --git a/pubspec.yaml b/pubspec.yaml index c53919b8..2581b688 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,31 +1,11 @@ name: toolbox -description: A new Flutter project. - -# The following line prevents the package from being accidentally published to -# pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev - -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +description: A server toolbox app. +publish_to: 'none' version: 1.0.0+1 environment: sdk: ">=2.17.0 <3.0.0" -# Dependencies specify other packages that your package needs in order to work. -# To automatically upgrade your package dependencies to the latest versions -# consider running `flutter pub upgrade --major-versions`. Alternatively, -# dependencies can be manually updated by changing the version numbers below to -# the latest version available on pub.dev. To see which dependencies have newer -# versions available, run `flutter pub outdated`. dependencies: flutter: sdk: flutter @@ -54,10 +34,10 @@ dependencies: intl: ^0.18.0 # xterm: ^3.5.0 xterm: - path: ../xterm.dart - # git: - # ref: master - # url: https://github.com/lollipopkit/xterm.dart + #path: ../xterm.dart + git: + ref: master + url: https://github.com/lollipopkit/xterm.dart file_picker: ^5.3.2 plain_notification_token: ^0.0.4 highlight: ^0.7.0 @@ -70,24 +50,13 @@ dev_dependencies: flutter_native_splash: ^2.1.6 hive_generator: ^2.0.0 build_runner: ^2.3.2 + flutter_lints: ^2.0.0 flutter_test: sdk: flutter - # The "flutter_lints" package below contains a set of recommended lints to - # encourage good coding practices. The lint set provided by the package is - # activated in the `analysis_options.yaml` file located at the root of your - # package. See that file for information about deactivating specific lint - # rules and activating additional ones. - flutter_lints: ^2.0.0 - -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec -# The following section is specific to Flutter. flutter: generate: true - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. + uses-material-design: true # To add assets to your application, add an assets section, like this: @@ -182,4 +151,4 @@ flutter_native_splash: - 'ios/Runner/Info-Profile.plist' - 'ios/Runner/Info-Release.plist' # To enable support for Android 12, set the following parameter to true. Defaults to false. - #android12: true + android12: true