From eb0100d432aa612dcc15bcf6d199e571295353bb Mon Sep 17 00:00:00 2001 From: lollipopkit Date: Thu, 23 May 2024 18:23:26 +0800 Subject: [PATCH] opt. --- .../tech/lolli/toolbox/widget/HomeWidget.kt | 1 + ios/Runner.xcodeproj/project.pbxproj | 36 ++++++------- lib/core/route.dart | 8 ++- lib/data/model/server/pve.dart | 21 ++------ lib/data/model/server/wol_cfg.dart | 4 +- lib/data/provider/server.dart | 2 +- lib/data/res/build_data.dart | 6 +-- lib/view/page/container.dart | 6 +-- lib/view/page/home/home.dart | 1 - lib/view/page/home/wear.dart | 1 - lib/view/page/server/edit.dart | 3 -- lib/view/page/server/tab.dart | 1 - lib/view/page/setting/entry.dart | 1 - lib/view/page/snippet/edit.dart | 3 -- lib/view/page/snippet/list.dart | 1 - lib/view/page/ssh/page.dart | 1 - lib/view/page/ssh/tab.dart | 51 +++++++++--------- lib/view/page/storage/sftp.dart | 10 +++- lib/view/widget/popup_menu.dart | 34 ------------ lib/view/widget/server_func_btns.dart | 6 +-- linux/flutter/generated_plugin_registrant.cc | 4 ++ linux/flutter/generated_plugins.cmake | 1 + macos/Flutter/GeneratedPluginRegistrant.swift | 2 + macos/Runner.xcodeproj/project.pbxproj | 12 ++--- pubspec.lock | 54 ++++++++++++------- pubspec.yaml | 17 +++--- .../flutter/generated_plugin_registrant.cc | 3 ++ windows/flutter/generated_plugins.cmake | 1 + 28 files changed, 137 insertions(+), 154 deletions(-) delete mode 100644 lib/view/widget/popup_menu.dart diff --git a/android/app/src/main/kotlin/tech/lolli/toolbox/widget/HomeWidget.kt b/android/app/src/main/kotlin/tech/lolli/toolbox/widget/HomeWidget.kt index 415003fc..ebf28203 100644 --- a/android/app/src/main/kotlin/tech/lolli/toolbox/widget/HomeWidget.kt +++ b/android/app/src/main/kotlin/tech/lolli/toolbox/widget/HomeWidget.kt @@ -95,6 +95,7 @@ class HomeWidget : AppWidgetProvider() { appWidgetManager.updateAppWidget(appWidgetId, views) } } catch (e: Exception) { + println("ServerBoxHomeWidget: ${e.localizedMessage}") GlobalScope.launch(Dispatchers.Main) main@ { views.setViewVisibility(R.id.widget_cpu_label, View.INVISIBLE) views.setViewVisibility(R.id.widget_mem_label, View.INVISIBLE) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 9b877c41..b5d0fe01 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -690,7 +690,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 908; + CURRENT_PROJECT_VERSION = 909; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -700,7 +700,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.908; + MARKETING_VERSION = 1.0.909; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -826,7 +826,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 908; + CURRENT_PROJECT_VERSION = 909; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -836,7 +836,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.908; + MARKETING_VERSION = 1.0.909; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -854,7 +854,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 908; + CURRENT_PROJECT_VERSION = 909; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -864,7 +864,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.908; + MARKETING_VERSION = 1.0.909; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -885,7 +885,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 908; + CURRENT_PROJECT_VERSION = 909; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -898,7 +898,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.908; + MARKETING_VERSION = 1.0.909; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; @@ -924,7 +924,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 908; + CURRENT_PROJECT_VERSION = 909; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -937,7 +937,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.908; + MARKETING_VERSION = 1.0.909; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -960,7 +960,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 908; + CURRENT_PROJECT_VERSION = 909; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -973,7 +973,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.908; + MARKETING_VERSION = 1.0.909; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -996,7 +996,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 908; + CURRENT_PROJECT_VERSION = 909; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_PREVIEWS = YES; @@ -1008,7 +1008,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.908; + MARKETING_VERSION = 1.0.909; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; @@ -1037,7 +1037,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 908; + CURRENT_PROJECT_VERSION = 909; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_PREVIEWS = YES; @@ -1049,7 +1049,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.908; + MARKETING_VERSION = 1.0.909; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_NAME = ServerBox; @@ -1075,7 +1075,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 908; + CURRENT_PROJECT_VERSION = 909; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_PREVIEWS = YES; @@ -1087,7 +1087,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.908; + MARKETING_VERSION = 1.0.909; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_NAME = ServerBox; diff --git a/lib/core/route.dart b/lib/core/route.dart index 57c8257b..de29e6c0 100644 --- a/lib/core/route.dart +++ b/lib/core/route.dart @@ -3,6 +3,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:toolbox/data/model/server/private_key_info.dart'; import 'package:toolbox/data/model/server/server_private_info.dart'; +import 'package:toolbox/data/res/build_data.dart'; import 'package:toolbox/data/res/provider.dart'; import 'package:toolbox/data/res/store.dart'; import 'package:toolbox/view/page/backup.dart'; @@ -154,8 +155,11 @@ class AppRoutes { return AppRoutes( DebugPage( key: key, - notifier: Pros.debug.widgets, - onClear: Pros.debug.clear, + args: DebugPageArgs( + notifier: Pros.debug.widgets, + onClear: Pros.debug.clear, + title: 'Logs(${BuildData.build})', + ), ), 'debug', ); diff --git a/lib/data/model/server/pve.dart b/lib/data/model/server/pve.dart index cb5bb617..0f7fc2f9 100644 --- a/lib/data/model/server/pve.dart +++ b/lib/data/model/server/pve.dart @@ -130,12 +130,7 @@ final class PveLxc extends PveResIface implements PveCtrlIface { @override String get summary { if (available) { - return uptime.secondsToDuration().toAgoStr( - day: l10n.day, - hour: l10n.hour, - minute: l10n.minute, - second: l10n.second, - ); + return uptime.secondsToDuration().toAgoStr; } return l10n.stopped; } @@ -213,12 +208,7 @@ final class PveQemu extends PveResIface implements PveCtrlIface { @override String get summary { if (available) { - return uptime.secondsToDuration().toAgoStr( - day: l10n.day, - hour: l10n.hour, - minute: l10n.minute, - second: l10n.second, - ); + return uptime.secondsToDuration().toAgoStr; } return l10n.stopped; } @@ -268,12 +258,7 @@ final class PveNode extends PveResIface { String get topRight { if (isRunning) { - return uptime.secondsToDuration().toAgoStr( - day: l10n.day, - hour: l10n.hour, - minute: l10n.minute, - second: l10n.second, - ); + return uptime.secondsToDuration().toAgoStr; } return l10n.stopped; } diff --git a/lib/data/model/server/wol_cfg.dart b/lib/data/model/server/wol_cfg.dart index 5095a5eb..de4524af 100644 --- a/lib/data/model/server/wol_cfg.dart +++ b/lib/data/model/server/wol_cfg.dart @@ -39,7 +39,7 @@ final class WakeOnLanCfg { return (err, valid); } - Future wake() async { + Future wake() { if (!validate().$2) { throw Exception('Invalid WakeOnLanCfg'); } @@ -48,7 +48,7 @@ final class WakeOnLanCfg { final mac_ = MACAddress(mac); final pwd_ = pwd != null ? SecureONPassword(pwd!) : null; final obj = WakeOnLAN(ip_, mac_, password: pwd_); - await obj.wake( + return obj.wake( repeat: 3, repeatDelay: const Duration(milliseconds: 500), ); diff --git a/lib/data/provider/server.dart b/lib/data/provider/server.dart index e06bbfce..28c374ba 100644 --- a/lib/data/provider/server.dart +++ b/lib/data/provider/server.dart @@ -283,7 +283,7 @@ class ServerProvider extends ChangeNotifier { // message: 'Wake on lan failed: $e', // ); // _setServerState(s, ServerConn.failed); - // Loggers.app.warning('Wake on lan failed', e); + Loggers.app.warning('Wake on lan failed', e); // return; } } diff --git a/lib/data/res/build_data.dart b/lib/data/res/build_data.dart index 37437ff7..5dd2b134 100644 --- a/lib/data/res/build_data.dart +++ b/lib/data/res/build_data.dart @@ -2,9 +2,9 @@ class BuildData { static const String name = "ServerBox"; - static const int build = 908; + static const int build = 909; static const String engine = "3.22.0"; - static const String buildAt = "2024-05-22 22:25:06"; - static const int modifications = 4; + static const String buildAt = "2024-05-23 00:45:04"; + static const int modifications = 11; static const int script = 48; } diff --git a/lib/view/page/container.dart b/lib/view/page/container.dart index d7458f8e..a9f2f68f 100644 --- a/lib/view/page/container.dart +++ b/lib/view/page/container.dart @@ -14,7 +14,6 @@ import 'package:toolbox/data/res/store.dart'; import '../../data/model/container/ps.dart'; import '../../data/model/server/server_private_info.dart'; import '../../data/provider/container.dart'; -import '../widget/popup_menu.dart'; import '../widget/two_line_text.dart'; class ContainerPage extends StatefulWidget { @@ -260,8 +259,9 @@ class _ContainerPageState extends State { Widget _buildMoreBtn(ContainerPs dItem) { return PopupMenu( - items: ContainerMenu.items(dItem.running), - builder: (e) => PopMenu.build(e, e.icon, e.toStr), + items: ContainerMenu.items(dItem.running) + .map((e) => PopMenu.build(e, e.icon, e.toStr)) + .toList(), onSelected: (item) => _onTapMoreBtn(item, dItem), ); } diff --git a/lib/view/page/home/home.dart b/lib/view/page/home/home.dart index ebccfe77..8153c5f8 100644 --- a/lib/view/page/home/home.dart +++ b/lib/view/page/home/home.dart @@ -341,7 +341,6 @@ ${GithubIds.participants.map((e) => '[$e](${e.url})').join(' ')} build: BuildData.build, url: '${Urls.cdnBase}/update.json', context: context, - updateL10n: l10n.update, ); } HomeWidgetMC.update(); diff --git a/lib/view/page/home/wear.dart b/lib/view/page/home/wear.dart index 174caa05..3227f891 100644 --- a/lib/view/page/home/wear.dart +++ b/lib/view/page/home/wear.dart @@ -77,7 +77,6 @@ final class _WearHomeState extends State with AfterLayoutMixin { build: BuildData.build, url: '${Urls.cdnBase}/update.json', context: context, - updateL10n: l10n.update, ); } await Pros.server.load(); diff --git a/lib/view/page/server/edit.dart b/lib/view/page/server/edit.dart index aebc8a88..ee9d6826 100644 --- a/lib/view/page/server/edit.dart +++ b/lib/view/page/server/edit.dart @@ -255,9 +255,6 @@ class _ServerEditPageState extends State { onChanged: (p0) => _tags = p0, allTags: [...Pros.server.tags.value], onRenameTag: Pros.server.renameTag, - renameL10n: l10n.rename, - tagL10n: l10n.tag, - addL10n: l10n.add, ), ListTile( title: Text(l10n.autoConnect), diff --git a/lib/view/page/server/tab.dart b/lib/view/page/server/tab.dart index 11ae8ef6..e883728b 100644 --- a/lib/view/page/server/tab.dart +++ b/lib/view/page/server/tab.dart @@ -214,7 +214,6 @@ class _ServerPageState extends State _tag = p0; }), initTag: _tag, - allL10n: l10n.all, ); } diff --git a/lib/view/page/setting/entry.dart b/lib/view/page/setting/entry.dart index 1aed3aa7..afd6dbf9 100644 --- a/lib/view/page/setting/entry.dart +++ b/lib/view/page/setting/entry.dart @@ -204,7 +204,6 @@ class _SettingPageState extends State { build: BuildData.build, url: Urls.updateCfg, force: BuildMode.isDebug, - updateL10n: l10n.update, ), ), trailing: StoreSwitch(prop: _setting.autoCheckAppUpdate), diff --git a/lib/view/page/snippet/edit.dart b/lib/view/page/snippet/edit.dart index 19e69d23..e653c9c0 100644 --- a/lib/view/page/snippet/edit.dart +++ b/lib/view/page/snippet/edit.dart @@ -136,9 +136,6 @@ class _SnippetEditPageState extends State onRenameTag: (old, n) => setState(() { Pros.snippet.renameTag(old, n); }), - renameL10n: l10n.rename, - tagL10n: l10n.tag, - addL10n: l10n.add, ); }, ), diff --git a/lib/view/page/snippet/list.dart b/lib/view/page/snippet/list.dart index 6dd40b1c..1b5ea358 100644 --- a/lib/view/page/snippet/list.dart +++ b/lib/view/page/snippet/list.dart @@ -69,7 +69,6 @@ class _SnippetListPageState extends State { onTagChanged: (tag) => setState(() => _tag = tag), initTag: _tag, width: _media.size.width, - allL10n: l10n.all, ), footer: UIs.height77, buildDefaultDragHandles: false, diff --git a/lib/view/page/ssh/page.dart b/lib/view/page/ssh/page.dart index 7701f135..dd81d442 100644 --- a/lib/view/page/ssh/page.dart +++ b/lib/view/page/ssh/page.dart @@ -5,7 +5,6 @@ import 'package:dartssh2/dartssh2.dart'; import 'package:fl_lib/fl_lib.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_background_service/flutter_background_service.dart'; import 'package:provider/provider.dart'; import 'package:toolbox/core/extension/context/locale.dart'; diff --git a/lib/view/page/ssh/tab.dart b/lib/view/page/ssh/tab.dart index 1f7cfd3b..fdf5b504 100644 --- a/lib/view/page/ssh/tab.dart +++ b/lib/view/page/ssh/tab.dart @@ -17,15 +17,14 @@ class SSHTabPage extends StatefulWidget { class _SSHTabPageState extends State with TickerProviderStateMixin, AutomaticKeepAliveClientMixin { - late final _tabIds = { - l10n.add: _buildAddPage(), + late final _tabMap = { + l10n.add: (page: _buildAddPage(), focus: null), }; late var _tabController = TabController( - length: _tabIds.length, + length: _tabMap.length, vsync: this, ); final _fabRN = ValueNotifier(0); - final _focusMap = {}; @override Widget build(BuildContext context) { @@ -33,13 +32,14 @@ class _SSHTabPageState extends State return Scaffold( appBar: TabBar( controller: _tabController, - tabs: _tabIds.keys.map(_buildTabItem).toList(), + tabs: _tabMap.keys.map(_buildTabItem).toList(), isScrollable: true, tabAlignment: TabAlignment.start, dividerColor: Colors.transparent, onTap: (value) { _fabRN.value = value; - _focusMap[_tabIds.keys.elementAt(value)]?.requestFocus(); + final mapKey = _tabMap.keys.elementAt(value); + _tabMap[mapKey]?.focus?.requestFocus(); }, ), body: _buildBody(), @@ -67,9 +67,9 @@ class _SSHTabPageState extends State children: [ Text(e), UIs.width7, - IconButton( - icon: const Icon(Icons.close, size: 17), - onPressed: () async { + IconBtn( + icon: Icons.close, + onTap: () async { final confirm = await context.showRoundDialog( title: l10n.attention, child: Text('${l10n.close} SSH ${l10n.conn}($e) ?'), @@ -87,7 +87,7 @@ class _SSHTabPageState extends State if (confirm != true) { return; } - _tabIds.remove(e); + _tabMap.remove(e); _refreshTabs(); }, ), @@ -131,38 +131,39 @@ class _SSHTabPageState extends State return TabBarView( physics: const NeverScrollableScrollPhysics(), controller: _tabController, - children: _tabIds.values.toList(), + children: _tabMap.values.map((e) => e.page).toList(), ); } void _onTapInitCard(ServerPrivateInfo spi) { final name = () { - if (_tabIds.containsKey(spi.name)) { - return '${spi.name}(${_tabIds.length + 1})'; + if (_tabMap.containsKey(spi.name)) { + return '${spi.name}(${_tabMap.length + 1})'; } return spi.name; }(); - final focus = _focusMap.putIfAbsent(name, () => FocusNode()); - _tabIds[name] = SSHPage( - spi: spi, + final focus = FocusNode(); + _tabMap[name] = ( + page: SSHPage( + spi: spi, + focus: focus, + notFromTab: false, + onSessionEnd: () { + _tabMap.remove(name); + _refreshTabs(); + }, + ), focus: focus, - notFromTab: false, - onSessionEnd: () { - // debugPrint("Session done received on page whose tabId = $name"); - // debugPrint("key = $key"); - _tabIds.remove(name); - _refreshTabs(); - }, ); _refreshTabs(); - final idx = _tabIds.length - 1; + final idx = _tabMap.length - 1; _tabController.animateTo(idx); _fabRN.value = idx; } void _refreshTabs() { _tabController = TabController( - length: _tabIds.length, + length: _tabMap.length, vsync: this, ); setState(() {}); diff --git a/lib/view/page/storage/sftp.dart b/lib/view/page/storage/sftp.dart index 3c1da2f7..f11fe659 100644 --- a/lib/view/page/storage/sftp.dart +++ b/lib/view/page/storage/sftp.dart @@ -677,7 +677,15 @@ class _SftpPageState extends State with AfterLayoutMixin { Loggers.app.warning('$op failed', e, s); return ctx.showRoundDialog( title: l10n.error, - child: Text(e.toString()), + child: SingleChildScrollView( + child: Column( + children: [ + Text(e.toString()), + const SizedBox(height: 7), + SimpleMarkdown(data: s.toString()), + ], + ), + ), actions: [ TextButton( onPressed: () => ctx.pop(), diff --git a/lib/view/widget/popup_menu.dart b/lib/view/widget/popup_menu.dart deleted file mode 100644 index c6b903ea..00000000 --- a/lib/view/widget/popup_menu.dart +++ /dev/null @@ -1,34 +0,0 @@ -import 'package:fl_lib/fl_lib.dart'; -import 'package:flutter/material.dart'; - -class PopupMenu extends StatelessWidget { - final List items; - final Widget Function(T) builder; - final void Function(T) onSelected; - final Widget child; - final EdgeInsetsGeometry padding; - final T? initialValue; - - const PopupMenu({ - super.key, - required this.items, - required this.builder, - required this.onSelected, - this.child = UIs.popMenuChild, - this.padding = const EdgeInsets.all(7), - this.initialValue, - }); - - @override - Widget build(BuildContext context) { - return PopupMenuButton( - itemBuilder: (_) => - items.map((e) => PopupMenuItem(value: e, child: builder(e))).toList(), - onSelected: onSelected, - initialValue: initialValue, - padding: padding, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), - child: child, - ); - } -} diff --git a/lib/view/widget/server_func_btns.dart b/lib/view/widget/server_func_btns.dart index 1d118637..bc6c7345 100644 --- a/lib/view/widget/server_func_btns.dart +++ b/lib/view/widget/server_func_btns.dart @@ -17,7 +17,6 @@ import '../../core/route.dart'; import '../../core/utils/server.dart'; import '../../data/model/pkg/upgrade_info.dart'; import '../../data/model/server/server_private_info.dart'; -import 'popup_menu.dart'; class ServerFuncBtnsTopRight extends StatelessWidget { final ServerPrivateInfo spi; @@ -30,8 +29,9 @@ class ServerFuncBtnsTopRight extends StatelessWidget { @override Widget build(BuildContext context) { return PopupMenu( - items: ServerFuncBtn.values, - builder: (e) => PopMenu.build(e, e.icon, e.toStr), + items: ServerFuncBtn.values + .map((e) => PopMenu.build(e, e.icon, e.toStr)) + .toList(), padding: const EdgeInsets.symmetric(horizontal: 10), onSelected: (val) => _onTapMoreBtns(val, spi, context), ); diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index 965f5cf6..412a5437 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -7,6 +7,7 @@ #include "generated_plugin_registrant.h" #include +#include #include #include #include @@ -15,6 +16,9 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) dynamic_color_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin"); dynamic_color_plugin_register_with_registrar(dynamic_color_registrar); + g_autoptr(FlPluginRegistrar) gtk_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "GtkPlugin"); + gtk_plugin_register_with_registrar(gtk_registrar); g_autoptr(FlPluginRegistrar) screen_retriever_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin"); screen_retriever_plugin_register_with_registrar(screen_retriever_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index dacf00d7..eb9e8cbb 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -4,6 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST dynamic_color + gtk screen_retriever url_launcher_linux window_manager diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index c6be844b..87f22952 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,6 +5,7 @@ import FlutterMacOS import Foundation +import app_links import device_info_plus import dynamic_color import icloud_storage @@ -18,6 +19,7 @@ import wakelock_plus import window_manager func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin")) IcloudStoragePlugin.register(with: registry.registrar(forPlugin: "IcloudStoragePlugin")) diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index 6463ca36..288806e5 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -471,7 +471,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 908; + CURRENT_PROJECT_VERSION = 909; DEVELOPMENT_TEAM = BA88US33G6; INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "Server Box"; @@ -481,7 +481,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 1.0.908; + MARKETING_VERSION = 1.0.909; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "Server Box"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -608,7 +608,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 908; + CURRENT_PROJECT_VERSION = 909; DEVELOPMENT_TEAM = BA88US33G6; INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "Server Box"; @@ -618,7 +618,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 1.0.908; + MARKETING_VERSION = 1.0.909; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "Server Box"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -638,7 +638,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "3rd Party Mac Developer Application"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 908; + CURRENT_PROJECT_VERSION = 909; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=macosx*]" = BA88US33G6; INFOPLIST_FILE = Runner/Info.plist; @@ -649,7 +649,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 1.0.908; + MARKETING_VERSION = 1.0.909; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "Server Box"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/pubspec.lock b/pubspec.lock index 2c9c748d..18d42a75 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -33,6 +33,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.2" + app_links: + dependency: transitive + description: + name: app_links + sha256: "96e677810b83707ff5e10fac11e4839daa0ea4e0123c35864c092699165eb3db" + url: "https://pub.dev" + source: hosted + version: "6.1.1" archive: dependency: transitive description: @@ -262,11 +270,9 @@ packages: dartssh2: dependency: "direct main" description: - path: "." - ref: dev - resolved-ref: d62d7e64c99de62a52495f3dedbf6b8983e4ce77 - url: "https://github.com/lollipopkit/dartssh2" - source: git + path: "../dartssh2" + relative: true + source: path version: "2.9.1-pre" dbus: dependency: transitive @@ -391,11 +397,9 @@ packages: fl_lib: dependency: "direct main" description: - path: "." - ref: main - resolved-ref: d6f282b4883615cc5a31b5f3a720b6a74d5285f4 - url: "https://github.com/lollipopkit/fl_lib" - source: git + path: "../fl_lib" + relative: true + source: path version: "0.0.1" flutter: dependency: "direct main" @@ -553,6 +557,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.1" + gtk: + dependency: transitive + description: + name: gtk + sha256: e8ce9ca4b1df106e4d72dad201d345ea1a036cc12c360f1a7d5a758f78ffa42c + url: "https://pub.dev" + source: hosted + version: "2.1.0" highlight: dependency: "direct main" description: @@ -1145,6 +1157,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.4" + shortid: + dependency: transitive + description: + name: shortid + sha256: d0b40e3dbb50497dad107e19c54ca7de0d1a274eb9b4404991e443dadb9ebedb + url: "https://pub.dev" + source: hosted + version: "0.1.2" sky_engine: dependency: transitive description: flutter @@ -1468,10 +1488,10 @@ packages: dependency: transitive description: name: window_manager - sha256: b3c895bdf936c77b83c5254bec2e6b3f066710c1f89c38b20b8acc382b525494 + sha256: "8699323b30da4cdbe2aa2e7c9de567a6abd8a97d9a5c850a3c86dcd0b34bbfbf" url: "https://pub.dev" source: hosted - version: "0.3.8" + version: "0.3.9" xdg_directories: dependency: transitive description: @@ -1491,11 +1511,9 @@ packages: xterm: dependency: "direct main" description: - path: "." - ref: a343bc2fdc11fbc7dbfc1f170692426a6fe01cb9 - resolved-ref: a343bc2fdc11fbc7dbfc1f170692426a6fe01cb9 - url: "https://github.com/lollipopkit/xterm.dart" - source: git + path: "../xterm.dart" + relative: true + source: path version: "4.0.0" yaml: dependency: transitive @@ -1514,5 +1532,5 @@ packages: source: hosted version: "0.0.6" sdks: - dart: ">=3.3.3 <4.0.0" + dart: ">=3.3.0 <4.0.0" flutter: ">=3.19.0" diff --git a/pubspec.yaml b/pubspec.yaml index 2a623ead..9c7c36a9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,22 +15,17 @@ dependencies: hive_flutter: ^1.1.0 dio: ^5.2.1 after_layout: ^1.1.0 - dartssh2: #^2.9.1-pre - # newer version has some issues + dartssh2: git: ref: dev url: https://github.com/lollipopkit/dartssh2 - #path: ../dartssh2 circle_chart: git: url: https://github.com/lollipopkit/circle_chart ref: main - # path: ../circle_chart easy_isolate: ^1.3.0 intl: ^0.19.0 - # xterm: ^3.5.0 xterm: - # path: ../xterm.dart git: ref: a343bc2fdc11fbc7dbfc1f170692426a6fe01cb9 url: https://github.com/lollipopkit/xterm.dart @@ -41,7 +36,6 @@ dependencies: shared_preferences: ^2.1.1 dynamic_color: ^1.6.6 watch_connectivity: - #path: ../watch_connectivity git: ref: master url: https://github.com/lollipopkit/watch_connectivity @@ -64,7 +58,14 @@ dependencies: url: https://github.com/lollipopkit/fl_lib ref: main device_info_plus: ^10.1.0 - # path: ../fl_lib + +dependency_overrides: + dartssh2: + path: ../dartssh2 + fl_lib: + path: ../fl_lib + xterm: + path: ../xterm.dart dev_dependencies: flutter_native_splash: ^2.1.6 diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 28c6f2d7..3541e497 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,6 +6,7 @@ #include "generated_plugin_registrant.h" +#include #include #include #include @@ -15,6 +16,8 @@ #include void RegisterPlugins(flutter::PluginRegistry* registry) { + AppLinksPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("AppLinksPluginCApi")); DynamicColorPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("DynamicColorPluginCApi")); LocalAuthPluginRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 2e41e0f1..f47b060b 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + app_links dynamic_color local_auth_windows permission_handler_windows