mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-18 15:54:35 +01:00
new: ssh page zoom (#256)
This commit is contained in:
@@ -241,6 +241,7 @@
|
|||||||
"system": "Systeme",
|
"system": "Systeme",
|
||||||
"tag": "Tags",
|
"tag": "Tags",
|
||||||
"temperature": "Temperatur",
|
"temperature": "Temperatur",
|
||||||
|
"termFontSizeTip": "Diese Einstellung beeinflusst die Größe des Terminals (Breite und Höhe).",
|
||||||
"terminal": "Terminal",
|
"terminal": "Terminal",
|
||||||
"test": "Prüfung",
|
"test": "Prüfung",
|
||||||
"textScaler": "Skalierung der Schriftart",
|
"textScaler": "Skalierung der Schriftart",
|
||||||
|
|||||||
@@ -241,6 +241,7 @@
|
|||||||
"system": "System",
|
"system": "System",
|
||||||
"tag": "Tags",
|
"tag": "Tags",
|
||||||
"temperature": "Temperature",
|
"temperature": "Temperature",
|
||||||
|
"termFontSizeTip": "This setting will affect the terminal size (width and height).",
|
||||||
"terminal": "Terminal",
|
"terminal": "Terminal",
|
||||||
"test": "Test",
|
"test": "Test",
|
||||||
"textScaler": "Text scaler",
|
"textScaler": "Text scaler",
|
||||||
|
|||||||
@@ -241,6 +241,7 @@
|
|||||||
"system": "Sistema",
|
"system": "Sistema",
|
||||||
"tag": "Etiqueta",
|
"tag": "Etiqueta",
|
||||||
"temperature": "Temperatura",
|
"temperature": "Temperatura",
|
||||||
|
"termFontSizeTip": "Este ajuste afectará el tamaño del terminal (ancho y alto).",
|
||||||
"terminal": "Terminal",
|
"terminal": "Terminal",
|
||||||
"test": "Prueba",
|
"test": "Prueba",
|
||||||
"textScaler": "Escalar texto",
|
"textScaler": "Escalar texto",
|
||||||
@@ -282,4 +283,4 @@
|
|||||||
"whenOpenApp": "Al abrir la App",
|
"whenOpenApp": "Al abrir la App",
|
||||||
"willTakEeffectImmediately": "Los cambios tendrán efecto inmediatamente",
|
"willTakEeffectImmediately": "Los cambios tendrán efecto inmediatamente",
|
||||||
"write": "Escribir"
|
"write": "Escribir"
|
||||||
}
|
}
|
||||||
@@ -241,6 +241,7 @@
|
|||||||
"system": "Système",
|
"system": "Système",
|
||||||
"tag": "Étiquettes",
|
"tag": "Étiquettes",
|
||||||
"temperature": "Température",
|
"temperature": "Température",
|
||||||
|
"termFontSizeTip": "Ce paramètre affectera la taille du terminal (largeur et hauteur).",
|
||||||
"terminal": "Terminal",
|
"terminal": "Terminal",
|
||||||
"test": "Tester",
|
"test": "Tester",
|
||||||
"textScaler": "Mise à l'échelle du texte",
|
"textScaler": "Mise à l'échelle du texte",
|
||||||
|
|||||||
@@ -241,6 +241,7 @@
|
|||||||
"system": "Sistem",
|
"system": "Sistem",
|
||||||
"tag": "Tag",
|
"tag": "Tag",
|
||||||
"temperature": "Suhu",
|
"temperature": "Suhu",
|
||||||
|
"termFontSizeTip": "Pengaturan ini akan memengaruhi ukuran terminal (lebar dan tinggi).",
|
||||||
"terminal": "Terminal",
|
"terminal": "Terminal",
|
||||||
"test": "pengujian",
|
"test": "pengujian",
|
||||||
"textScaler": "Penskalaan font",
|
"textScaler": "Penskalaan font",
|
||||||
|
|||||||
@@ -241,6 +241,7 @@
|
|||||||
"system": "システム",
|
"system": "システム",
|
||||||
"tag": "タグ",
|
"tag": "タグ",
|
||||||
"temperature": "温度",
|
"temperature": "温度",
|
||||||
|
"termFontSizeTip": "この設定は端末のサイズ(幅と高さ)に影響します",
|
||||||
"terminal": "ターミナル",
|
"terminal": "ターミナル",
|
||||||
"test": "テスト",
|
"test": "テスト",
|
||||||
"textScaler": "テキストスケーラー",
|
"textScaler": "テキストスケーラー",
|
||||||
@@ -282,4 +283,4 @@
|
|||||||
"whenOpenApp": "アプリを開くとき",
|
"whenOpenApp": "アプリを開くとき",
|
||||||
"willTakEeffectImmediately": "変更は即座に有効になります",
|
"willTakEeffectImmediately": "変更は即座に有効になります",
|
||||||
"write": "書き込み"
|
"write": "書き込み"
|
||||||
}
|
}
|
||||||
@@ -241,6 +241,7 @@
|
|||||||
"system": "Sistema",
|
"system": "Sistema",
|
||||||
"tag": "Tag",
|
"tag": "Tag",
|
||||||
"temperature": "Temperatura",
|
"temperature": "Temperatura",
|
||||||
|
"termFontSizeTip": "Esta configuração afetará o tamanho do terminal (largura e altura).",
|
||||||
"terminal": "Terminal",
|
"terminal": "Terminal",
|
||||||
"test": "Teste",
|
"test": "Teste",
|
||||||
"textScaler": "Escala de texto",
|
"textScaler": "Escala de texto",
|
||||||
@@ -282,4 +283,4 @@
|
|||||||
"whenOpenApp": "Ao abrir o app",
|
"whenOpenApp": "Ao abrir o app",
|
||||||
"willTakEeffectImmediately": "As alterações serão aplicadas imediatamente",
|
"willTakEeffectImmediately": "As alterações serão aplicadas imediatamente",
|
||||||
"write": "Escrita"
|
"write": "Escrita"
|
||||||
}
|
}
|
||||||
@@ -241,6 +241,7 @@
|
|||||||
"system": "система",
|
"system": "система",
|
||||||
"tag": "тег",
|
"tag": "тег",
|
||||||
"temperature": "температура",
|
"temperature": "температура",
|
||||||
|
"termFontSizeTip": "Эта настройка повлияет на размер терминала (ширина и высота).",
|
||||||
"terminal": "терминал",
|
"terminal": "терминал",
|
||||||
"test": "тест",
|
"test": "тест",
|
||||||
"textScaler": "масштабирование текста",
|
"textScaler": "масштабирование текста",
|
||||||
@@ -282,4 +283,4 @@
|
|||||||
"whenOpenApp": "при открытии приложения",
|
"whenOpenApp": "при открытии приложения",
|
||||||
"willTakEeffectImmediately": "Изменения вступят в силу немедленно",
|
"willTakEeffectImmediately": "Изменения вступят в силу немедленно",
|
||||||
"write": "запись"
|
"write": "запись"
|
||||||
}
|
}
|
||||||
@@ -241,6 +241,7 @@
|
|||||||
"system": "系统",
|
"system": "系统",
|
||||||
"tag": "标签",
|
"tag": "标签",
|
||||||
"temperature": "温度",
|
"temperature": "温度",
|
||||||
|
"termFontSizeTip": "此设置会影响终端大小(宽高)",
|
||||||
"terminal": "终端",
|
"terminal": "终端",
|
||||||
"test": "测试",
|
"test": "测试",
|
||||||
"textScaler": "字体缩放",
|
"textScaler": "字体缩放",
|
||||||
|
|||||||
@@ -241,6 +241,7 @@
|
|||||||
"system": "系統",
|
"system": "系統",
|
||||||
"tag": "标签",
|
"tag": "标签",
|
||||||
"temperature": "溫度",
|
"temperature": "溫度",
|
||||||
|
"termFontSizeTip": "此設置將影響終端大小(寬度和高度)",
|
||||||
"terminal": "终端機",
|
"terminal": "终端機",
|
||||||
"test": "測試",
|
"test": "測試",
|
||||||
"textScaler": "字體縮放",
|
"textScaler": "字體縮放",
|
||||||
|
|||||||
@@ -563,16 +563,17 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTermFontSize() {
|
Widget _buildTermFontSize() {
|
||||||
return ListenableBuilder(
|
return ListTile(
|
||||||
listenable: _termFontSize,
|
title: Text(l10n.fontSize),
|
||||||
builder: (_, __) => ListTile(
|
subtitle: Text(l10n.termFontSizeTip, style: UIs.textGrey),
|
||||||
title: Text(l10n.fontSize),
|
trailing: ValueListenableBuilder(
|
||||||
trailing: Text(
|
valueListenable: _setting.termFontSize.listenable(),
|
||||||
_termFontSize.value.toString(),
|
builder: (_, val, __) => Text(
|
||||||
|
val.toString(),
|
||||||
style: UIs.text15,
|
style: UIs.text15,
|
||||||
),
|
),
|
||||||
onTap: () => _showFontSizeDialog(_termFontSize, _setting.termFontSize),
|
|
||||||
),
|
),
|
||||||
|
onTap: () => _showFontSizeDialog(_termFontSize, _setting.termFontSize),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:math' as math;
|
||||||
|
|
||||||
import 'package:dartssh2/dartssh2.dart';
|
import 'package:dartssh2/dartssh2.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -57,6 +58,7 @@ class _SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin {
|
|||||||
late TerminalStyle _terminalStyle;
|
late TerminalStyle _terminalStyle;
|
||||||
late TerminalTheme _terminalTheme;
|
late TerminalTheme _terminalTheme;
|
||||||
late TextInputType _keyboardType;
|
late TextInputType _keyboardType;
|
||||||
|
late double _originTextSize;
|
||||||
double _virtKeyWidth = 0;
|
double _virtKeyWidth = 0;
|
||||||
double _virtKeysHeight = 0;
|
double _virtKeysHeight = 0;
|
||||||
|
|
||||||
@@ -69,13 +71,7 @@ class _SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
final fontFamilly = getFileName(Stores.setting.fontPath.fetch());
|
_initStoredCfg();
|
||||||
final textStyle = TextStyle(
|
|
||||||
fontFamily: fontFamilly,
|
|
||||||
fontSize: Stores.setting.termFontSize.fetch(),
|
|
||||||
);
|
|
||||||
_terminalStyle = TerminalStyle.fromTextStyle(textStyle);
|
|
||||||
_keyboardType = TextInputType.values[Stores.setting.keyboardType.fetch()];
|
|
||||||
_initVirtKeys();
|
_initVirtKeys();
|
||||||
|
|
||||||
Future.delayed(const Duration(milliseconds: 77), () async {
|
Future.delayed(const Duration(milliseconds: 77), () async {
|
||||||
@@ -138,17 +134,31 @@ class _SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin {
|
|||||||
_media.padding.bottom -
|
_media.padding.bottom -
|
||||||
_media.padding.top,
|
_media.padding.top,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(top: _media.padding.top),
|
padding: EdgeInsets.only(top: _media.padding.top, left: 7, right: 7),
|
||||||
child: TerminalView(
|
child: GestureDetector(
|
||||||
_terminal,
|
onScaleUpdate: (details) {
|
||||||
controller: _terminalController,
|
if (details.scale == 1) {
|
||||||
keyboardType: _keyboardType,
|
return;
|
||||||
textStyle: _terminalStyle,
|
}
|
||||||
theme: _terminalTheme,
|
final scale = math.pow(details.scale, 0.3);
|
||||||
deleteDetection: isMobile,
|
final fontSize = _originTextSize * scale;
|
||||||
autofocus: true,
|
if (fontSize < 7 || fontSize > 17) {
|
||||||
keyboardAppearance: _isDark ? Brightness.dark : Brightness.light,
|
return;
|
||||||
//hideScrollBar: false,
|
}
|
||||||
|
_terminalStyle = _terminalStyle.copyWith(fontSize: fontSize);
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
child: TerminalView(
|
||||||
|
_terminal,
|
||||||
|
controller: _terminalController,
|
||||||
|
keyboardType: _keyboardType,
|
||||||
|
textStyle: _terminalStyle,
|
||||||
|
theme: _terminalTheme,
|
||||||
|
deleteDetection: isMobile,
|
||||||
|
autofocus: true,
|
||||||
|
keyboardAppearance: _isDark ? Brightness.dark : Brightness.light,
|
||||||
|
//hideScrollBar: false,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -225,9 +235,7 @@ class _SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin {
|
|||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: _virtKeyWidth,
|
width: _virtKeyWidth,
|
||||||
height: _virtKeysHeight / _virtKeysList.length,
|
height: _virtKeysHeight / _virtKeysList.length,
|
||||||
child: Center(
|
child: Center(child: child),
|
||||||
child: child,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -474,6 +482,19 @@ class _SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin {
|
|||||||
iosConfiguration: IosConfiguration(),
|
iosConfiguration: IosConfiguration(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _initStoredCfg() {
|
||||||
|
final fontFamilly = getFileName(Stores.setting.fontPath.fetch());
|
||||||
|
final textSize = Stores.setting.termFontSize.fetch();
|
||||||
|
_originTextSize = textSize;
|
||||||
|
final textStyle = TextStyle(
|
||||||
|
fontFamily: fontFamilly,
|
||||||
|
fontSize: textSize,
|
||||||
|
);
|
||||||
|
|
||||||
|
_terminalStyle = TerminalStyle.fromTextStyle(textStyle);
|
||||||
|
_keyboardType = TextInputType.values[Stores.setting.keyboardType.fetch()];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onStart(ServiceInstance service) async {}
|
Future<void> _onStart(ServiceInstance service) async {}
|
||||||
|
|||||||
Reference in New Issue
Block a user