#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

@@ -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();
}