#46 SSH term fontSize

This commit is contained in:
lollipopkit
2023-05-25 15:21:57 +08:00
parent 472599498e
commit 29683572b9
13 changed files with 82 additions and 16 deletions

View File

@@ -443,6 +443,12 @@ abstract class S {
/// **'Files'**
String get files;
/// No description provided for @fontSize.
///
/// In en, this message translates to:
/// **'Font size'**
String get fontSize;
/// No description provided for @foundNUpdate.
///
/// In en, this message translates to:

View File

@@ -192,6 +192,9 @@ class SDe extends S {
@override
String get files => 'Dateien';
@override
String get fontSize => 'Schriftgröße';
@override
String foundNUpdate(Object count) {
return 'Update $count gefunden';

View File

@@ -192,6 +192,9 @@ class SEn extends S {
@override
String get files => 'Files';
@override
String get fontSize => 'Font size';
@override
String foundNUpdate(Object count) {
return 'Found $count update';

View File

@@ -192,6 +192,9 @@ class SZh extends S {
@override
String get files => '文件';
@override
String get fontSize => '字体大小';
@override
String foundNUpdate(Object count) {
return '找到 $count 个更新';

View File

@@ -360,7 +360,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 313;
CURRENT_PROJECT_VERSION = 314;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -368,7 +368,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.313;
MARKETING_VERSION = 1.0.314;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -491,7 +491,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 313;
CURRENT_PROJECT_VERSION = 314;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -499,7 +499,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.313;
MARKETING_VERSION = 1.0.314;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -516,7 +516,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 313;
CURRENT_PROJECT_VERSION = 314;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -524,7 +524,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.313;
MARKETING_VERSION = 1.0.314;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

View File

@@ -2,8 +2,8 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 313;
static const int build = 314;
static const String engine = "3.10.0";
static const String buildAt = "2023-05-16 17:56:08.999957";
static const int modifications = 6;
static const String buildAt = "2023-05-18 22:09:44.404990";
static const int modifications = 2;
}

View File

@@ -43,4 +43,8 @@ class SettingStore extends PersistentStore {
// Server order
StoreProperty<List<String>> get serverOrder =>
property('serverOrder', defaultValue: null);
// SSH term font size
StoreProperty<double> get termFontSize =>
property('termFontSize', defaultValue: 13);
}

View File

@@ -57,6 +57,7 @@
"fileNotExist": "{file} existiert nicht",
"fileTooLarge": "Datei '{file}' ist zu groß {size}, max {sizeMax}",
"files": "Dateien",
"fontSize": "Schriftgröße",
"foundNUpdate": "Update {count} gefunden",
"getPushTokenFailed": "Push-Token kann nicht abgerufen werden",
"gettingToken": "Getting token...",

View File

@@ -57,6 +57,7 @@
"fileNotExist": "{file} not exist",
"fileTooLarge": "File '{file}' too large {size}, max {sizeMax}",
"files": "Files",
"fontSize": "Font size",
"foundNUpdate": "Found {count} update",
"getPushTokenFailed": "Can't fetch push token",
"gettingToken": "Getting token...",

View File

@@ -57,6 +57,7 @@
"fileNotExist": "{file} 不存在",
"fileTooLarge": "文件 '{file}' 过大 '{size}',超过了 {sizeMax}",
"files": "文件",
"fontSize": "字体大小",
"foundNUpdate": "找到 {count} 个更新",
"getPushTokenFailed": "未能获取到推送token",
"gettingToken": "正在获取Token...",

View File

@@ -6,6 +6,7 @@ import 'package:flutter_material_color_picker/flutter_material_color_picker.dart
import 'package:provider/provider.dart';
import 'package:toolbox/core/extension/navigator.dart';
import 'package:toolbox/data/model/app/tab.dart';
import 'package:toolbox/view/widget/input_field.dart';
import '../../core/utils/misc.dart';
import '../../core/utils/platform.dart';
@@ -36,6 +37,7 @@ class _SettingPageState extends State<SettingPage> {
final updateIntervalKey = GlobalKey<PopupMenuButtonState<int>>();
final termThemeKey = GlobalKey<PopupMenuButtonState<int>>();
final maxRetryKey = GlobalKey<PopupMenuButtonState<int>>();
final fontSizeKey = GlobalKey<PopupMenuButtonState<double>>();
late final SettingStore _setting;
late final ServerProvider _serverProvider;
@@ -48,6 +50,7 @@ class _SettingPageState extends State<SettingPage> {
late int _nightMode;
late int _maxRetryCount;
late int _updateInterval;
late double _fontSize;
String? _pushToken;
@@ -69,6 +72,7 @@ class _SettingPageState extends State<SettingPage> {
_updateInterval = _setting.serverStatusUpdateInterval.fetch()!;
_maxRetryCount = _setting.maxRetryCount.fetch()!;
_selectedColorValue = _setting.primaryColor.fetch()!;
_fontSize = _setting.termFontSize.fetch()!;
}
@override
@@ -140,6 +144,7 @@ class _SettingPageState extends State<SettingPage> {
children: [
_buildTermTheme(),
_buildFont(),
_buildTermFontSize(),
].map((e) => RoundRectCard(e)).toList(),
);
}
@@ -527,4 +532,40 @@ class _SettingPageState extends State<SettingPage> {
trailing: buildSwitch(context, _setting.bgRun),
);
}
Widget _buildTermFontSize() {
return ListTile(
title: Text(_s.fontSize),
trailing: Text(
_fontSize.toString(),
style: textSize15,
),
onTap: () {
final ctrller = TextEditingController(text: _fontSize.toString());
showRoundDialog(
context: context,
title: Text(_s.fontSize),
child: Input(
controller: ctrller,
type: TextInputType.number,
icon: Icons.font_download,
),
actions: [
TextButton(
onPressed: () {
context.pop();
final fontSize = double.tryParse(ctrller.text);
if (fontSize == null) {
showRoundDialog(context: context, child: Text(_s.failed));
return;
}
_fontSize = fontSize;
_setting.termFontSize.put(_fontSize);
},
child: Text(_s.ok)),
],
);
},
);
}
}

View File

@@ -55,7 +55,10 @@ class _SSHPageState extends State<SSHPage> {
final termColorIdx = _setting.termColorIdx.fetch()!;
_termColors = TerminalColorsPlatform.values[termColorIdx].colors;
final fontFamilly = getFileName(_setting.fontPath.fetch());
final textStyle = TextStyle(fontFamily: fontFamilly);
final textStyle = TextStyle(
fontFamily: fontFamilly,
fontSize: _setting.termFontSize.fetch()!,
);
_terminalStyle = TerminalStyle.fromTextStyle(textStyle);
initTerminal();
}

View File

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