opt.: settings

This commit is contained in:
lollipopkit
2023-08-16 15:11:22 +08:00
parent c62c8e2c43
commit 329922a836
19 changed files with 121 additions and 131 deletions

View File

@@ -1349,7 +1349,7 @@ abstract class S {
/// No description provided for @versionUnknownUpdate.
///
/// In en, this message translates to:
/// **'Current: v1.0.{build}'**
/// **'Current: v1.0.{build}, click to check updates'**
String versionUnknownUpdate(Object build);
/// No description provided for @versionUpdated.

View File

@@ -672,7 +672,7 @@ class SDe extends S {
@override
String versionUnknownUpdate(Object build) {
return 'Aktuell: v1.0.$build';
return 'Aktuell: v1.0.$build. Klicken Sie hier, um nach Updates zu suchen';
}
@override

View File

@@ -672,7 +672,7 @@ class SEn extends S {
@override
String versionUnknownUpdate(Object build) {
return 'Current: v1.0.$build';
return 'Current: v1.0.$build, click to check updates';
}
@override

View File

@@ -672,7 +672,7 @@ class SId extends S {
@override
String versionUnknownUpdate(Object build) {
return 'Saat ini: v1.0.$build';
return 'Saat ini: v1.0.$build. Klik untuk memeriksa pembaruan.';
}
@override

View File

@@ -672,7 +672,7 @@ class SZh extends S {
@override
String versionUnknownUpdate(Object build) {
return '当前v1.0.$build';
return '当前v1.0.$build,点击检查更新';
}
@override
@@ -1371,7 +1371,7 @@ class SZhTw extends SZh {
@override
String versionUnknownUpdate(Object build) {
return '當前v1.0.$build';
return '當前v1.0.$build,點擊檢查更新';
}
@override

View File

@@ -470,7 +470,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 472;
CURRENT_PROJECT_VERSION = 473;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -478,7 +478,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.472;
MARKETING_VERSION = 1.0.473;
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 = 472;
CURRENT_PROJECT_VERSION = 473;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -610,7 +610,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.472;
MARKETING_VERSION = 1.0.473;
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 = 472;
CURRENT_PROJECT_VERSION = 473;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -636,7 +636,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.472;
MARKETING_VERSION = 1.0.473;
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 = 472;
CURRENT_PROJECT_VERSION = 473;
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.472;
MARKETING_VERSION = 1.0.473;
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 = 472;
CURRENT_PROJECT_VERSION = 473;
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.472;
MARKETING_VERSION = 1.0.473;
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 = 472;
CURRENT_PROJECT_VERSION = 473;
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.472;
MARKETING_VERSION = 1.0.473;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@@ -8,6 +8,13 @@ const _interactiveStates = <MaterialState>{
};
extension ColorX on Color {
String get toHex {
final redStr = red.toRadixString(16).padLeft(2, '0');
final greenStr = green.toRadixString(16).padLeft(2, '0');
final blueStr = blue.toRadixString(16).padLeft(2, '0');
return '#$redStr$greenStr$blueStr';
}
bool get isBrightColor {
return getBrightnessFromColor == Brightness.light;
}

View File

@@ -4,6 +4,16 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
extension StringX on String {
/// Format: `#8b2252` or `8b2252`
Color? get hexToColor {
final hexCode = replaceAll('#', '');
final val = int.tryParse('FF$hexCode', radix: 16);
if (val == null) {
return null;
}
return Color(val);
}
int get i => int.parse(this);
Uri get uri {

View File

@@ -2,8 +2,8 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 472;
static const int build = 473;
static const String engine = "3.10.6";
static const String buildAt = "2023-08-14 11:11:21.335805";
static const String buildAt = "2023-08-15 23:06:31.430481";
static const int modifications = 2;
}

View File

@@ -208,7 +208,7 @@
"urlOrJson": "URL oder JSON",
"user": "Benutzer",
"versionHaveUpdate": "Gefunden: v1.0.{build}, klicke zum Aktualisieren",
"versionUnknownUpdate": "Aktuell: v1.0.{build}",
"versionUnknownUpdate": "Aktuell: v1.0.{build}. Klicken Sie hier, um nach Updates zu suchen",
"versionUpdated": "v1.0.{build} ist bereits die neueste Version",
"viewErr": "Fehler anzeigen",
"virtKeyHelpClipboard": "In die Zwischenablage kopieren, wenn das ausgewählte Terminal nicht leer ist, andernfalls den Inhalt der Zwischenablage in das Terminal einfügen.",

View File

@@ -208,7 +208,7 @@
"urlOrJson": "URL or JSON",
"user": "User",
"versionHaveUpdate": "Found: v1.0.{build}, click to update",
"versionUnknownUpdate": "Current: v1.0.{build}",
"versionUnknownUpdate": "Current: v1.0.{build}, click to check updates",
"versionUpdated": "Current: v1.0.{build}, is up to date",
"viewErr": "See error",
"virtKeyHelpClipboard": "Copy to the clipboard if terminal selected is not empty, otherwise paste the contents of the clipboard to the terminal.",

View File

@@ -208,7 +208,7 @@
"urlOrJson": "URL atau JSON",
"user": "Username",
"versionHaveUpdate": "Ditemukan: v1.0.{build}, klik untuk memperbarui",
"versionUnknownUpdate": "Saat ini: v1.0.{build}",
"versionUnknownUpdate": "Saat ini: v1.0.{build}. Klik untuk memeriksa pembaruan.",
"versionUpdated": "Saat ini: v1.0.{build}, mutakhir",
"viewErr": "Lihat kesalahan",
"virtKeyHelpClipboard": "Salin ke clipboard jika terminal yang dipilih tidak kosong, jika tidak, tempel isi clipboard ke terminal.",

View File

@@ -208,7 +208,7 @@
"urlOrJson": "链接或JSON",
"user": "用户",
"versionHaveUpdate": "找到新版本v1.0.{build}, 点击更新",
"versionUnknownUpdate": "当前v1.0.{build}",
"versionUnknownUpdate": "当前v1.0.{build},点击检查更新",
"versionUpdated": "当前v1.0.{build}, 已是最新版本",
"viewErr": "查看错误",
"virtKeyHelpClipboard": "如果终端有选中字符,则复制选中字符至剪切板,否则粘贴剪切板内容至终端。",

View File

@@ -208,7 +208,7 @@
"urlOrJson": "鏈接或JSON",
"user": "用戶",
"versionHaveUpdate": "找到新版本v1.0.{build}, 點擊更新",
"versionUnknownUpdate": "當前v1.0.{build}",
"versionUnknownUpdate": "當前v1.0.{build},點擊檢查更新",
"versionUpdated": "當前v1.0.{build}, 已是最新版本",
"viewErr": "查看錯誤",
"virtKeyHelpClipboard": "如果終端有選中字符,則復製選中字符至剪切板,否則粘貼剪切板內容至終端。",

View File

@@ -372,7 +372,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: width / 1.2,
width: width,
child: Text(
device,
style: textSize11,
@@ -440,7 +440,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
return RoundRectCard(Padding(
padding: roundRectCardPadding,
child: Column(children: children),
));
),);
}
Widget _buildAnimatedText(Key key, String text, TextStyle style) {

View File

@@ -4,14 +4,14 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter_highlight/theme_map.dart';
import 'package:flutter_material_color_picker/flutter_material_color_picker.dart';
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:toolbox/core/extension/colorx.dart';
import 'package:toolbox/core/extension/locale.dart';
import 'package:toolbox/core/extension/navigator.dart';
import 'package:toolbox/core/extension/stringx.dart';
import 'package:toolbox/core/route.dart';
import 'package:toolbox/data/model/app/net_view.dart';
import 'package:toolbox/data/model/app/tab.dart';
import 'package:toolbox/view/page/ssh/virt_key_setting.dart';
import 'package:toolbox/view/widget/input_field.dart';
import 'package:toolbox/view/widget/value_notifier.dart';
@@ -41,7 +41,7 @@ class SettingPage extends StatefulWidget {
class _SettingPageState extends State<SettingPage> {
final _themeKey = GlobalKey<PopupMenuButtonState<int>>();
final _startPageKey = GlobalKey<PopupMenuButtonState<int>>();
//final _startPageKey = GlobalKey<PopupMenuButtonState<int>>();
final _updateIntervalKey = GlobalKey<PopupMenuButtonState<int>>();
final _maxRetryKey = GlobalKey<PopupMenuButtonState<int>>();
final _localeKey = GlobalKey<PopupMenuButtonState<String>>();
@@ -53,7 +53,6 @@ class _SettingPageState extends State<SettingPage> {
late final SettingStore _setting;
late final ServerProvider _serverProvider;
late MediaQueryData _media;
late S _s;
late SharedPreferences _sp;
@@ -75,7 +74,6 @@ class _SettingPageState extends State<SettingPage> {
@override
void didChangeDependencies() {
super.didChangeDependencies();
_media = MediaQuery.of(context);
_s = S.of(context)!;
_localeCode.value = _setting.locale.fetch() ?? _s.localeName;
}
@@ -141,8 +139,7 @@ class _SettingPageState extends State<SettingPage> {
_buildLocale(),
_buildThemeMode(),
_buildAppColor(),
_buildLaunchPage(),
_buildAutoCheckAppUpdate(),
//_buildLaunchPage(),
_buildCheckUpdate(),
];
if (isIOS) {
@@ -215,11 +212,10 @@ class _SettingPageState extends State<SettingPage> {
display = _s.versionUnknownUpdate(BuildData.build);
}
return ListTile(
trailing: const Icon(Icons.keyboard_arrow_right),
title: Text(
display,
),
title: Text(_s.autoCheckUpdate),
subtitle: Text(display, style: grey),
onTap: () => doUpdate(ctx, force: true),
trailing: buildSwitch(context, _setting.autoCheckAppUpdate),
);
},
);
@@ -282,77 +278,73 @@ class _SettingPageState extends State<SettingPage> {
_s.primaryColor,
),
onTap: () async {
final ctrl = TextEditingController(text: primaryColor.toHex);
await showRoundDialog(
context: context,
title: Text(_s.primaryColor),
child: SizedBox(
height: 211,
child: Center(
child: MaterialColorPicker(
shrinkWrap: true,
allowShades: true,
onColorChange: (color) {
_selectedColorValue.value = color.value;
},
selectedColor: primaryColor,
),
),
child: Input(
onSubmitted: _onSaveColor,
controller: ctrl,
hint: '#8b2252',
icon: Icons.colorize,
),
actions: [
TextButton(
onPressed: () {
_setting.primaryColor.put(_selectedColorValue.value);
Navigator.pop(context);
_showRestartSnackbar();
},
child: Text(_s.ok),
)
],
);
},
);
}
Widget _buildLaunchPage() {
final items = AppTab.values
.map(
(e) => PopupMenuItem(
value: e.index,
child: Text(tabTitleName(context, e)),
),
)
.toList();
return ListTile(
title: Text(
_s.launchPage,
),
onTap: () {
_startPageKey.currentState?.showButtonMenu();
},
trailing: ValueBuilder(
listenable: _launchPageIdx,
build: () => PopupMenuButton(
key: _startPageKey,
itemBuilder: (BuildContext context) => items,
initialValue: _launchPageIdx.value,
onSelected: (int idx) {
_launchPageIdx.value = idx;
_setting.launchPage.put(_launchPageIdx.value);
},
child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: _media.size.width * 0.35),
child: Text(
tabTitleName(context, AppTab.values[_launchPageIdx.value]),
textAlign: TextAlign.right,
style: textSize15,
),
),
),
),
);
void _onSaveColor(String s) {
final color = s.hexToColor;
if (color == null) {
showSnackBar(context, Text(_s.failed));
return;
}
_selectedColorValue.value = color.value;
_setting.primaryColor.put(_selectedColorValue.value);
context.pop();
_showRestartSnackbar();
}
// Widget _buildLaunchPage() {
// final items = AppTab.values
// .map(
// (e) => PopupMenuItem(
// value: e.index,
// child: Text(tabTitleName(context, e)),
// ),
// )
// .toList();
// return ListTile(
// title: Text(
// _s.launchPage,
// ),
// onTap: () {
// _startPageKey.currentState?.showButtonMenu();
// },
// trailing: ValueBuilder(
// listenable: _launchPageIdx,
// build: () => PopupMenuButton(
// key: _startPageKey,
// itemBuilder: (BuildContext context) => items,
// initialValue: _launchPageIdx.value,
// onSelected: (int idx) {
// _launchPageIdx.value = idx;
// _setting.launchPage.put(_launchPageIdx.value);
// },
// child: ConstrainedBox(
// constraints: BoxConstraints(maxWidth: _media.size.width * 0.35),
// child: Text(
// tabTitleName(context, AppTab.values[_launchPageIdx.value]),
// textAlign: TextAlign.right,
// style: textSize15,
// ),
// ),
// ),
// ),
// );
// }
Widget _buildMaxRetry() {
final items = List.generate(
10,
@@ -978,12 +970,4 @@ class _SettingPageState extends State<SettingPage> {
},
);
}
Widget _buildAutoCheckAppUpdate() {
return ListTile(
title: Text(_s.autoCheckUpdate),
subtitle: Text(_s.whenOpenApp, style: grey),
trailing: buildSwitch(context, _setting.autoCheckAppUpdate),
);
}
}

View File

@@ -475,9 +475,9 @@
baseConfigurationReference = C1C758C41C4E208965A68933 /* Pods-RunnerTests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CURRENT_PROJECT_VERSION = 472;
CURRENT_PROJECT_VERSION = 473;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0.472;
MARKETING_VERSION = 1.0.473;
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 = 472;
CURRENT_PROJECT_VERSION = 473;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0.472;
MARKETING_VERSION = 1.0.473;
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 = 472;
CURRENT_PROJECT_VERSION = 473;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0.472;
MARKETING_VERSION = 1.0.473;
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;

View File

@@ -332,14 +332,6 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_material_color_picker:
dependency: "direct main"
description:
name: flutter_material_color_picker
sha256: ca1e7749d228c9155ea24bce98e647cdbffa350e6f334f6c001f841cd3d9c987
url: "https://pub.dev"
source: hosted
version: "1.2.0"
flutter_native_splash:
dependency: "direct dev"
description:
@@ -1046,11 +1038,9 @@ packages:
xterm:
dependency: "direct main"
description:
path: "."
ref: master
resolved-ref: "132bbb310c6026ba1f5f2ef4eac81f874ee06774"
url: "https://github.com/lollipopkit/xterm.dart"
source: git
path: "../xterm.dart"
relative: true
source: path
version: "3.6.1-pre"
yaml:
dependency: transitive
@@ -1069,5 +1059,5 @@ packages:
source: hosted
version: "0.0.6"
sdks:
dart: ">=3.0.2 <4.0.0"
dart: ">=3.0.0 <4.0.0"
flutter: ">=3.10.0"

View File

@@ -40,7 +40,6 @@ dependencies:
countly_flutter: ^23.6.0
dartssh2: ^2.8.2
logging: ^1.0.2
flutter_material_color_picker: ^1.1.0+2
circle_chart:
git:
url: https://github.com/lollipopkit/circle_chart
@@ -55,10 +54,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