mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
fix: ssh term (#365)
This commit is contained in:
@@ -16,7 +16,7 @@ class MyApp extends StatelessWidget {
|
||||
_setup(context);
|
||||
return ListenableBuilder(
|
||||
listenable: RebuildNodes.app,
|
||||
builder: (_, __) {
|
||||
builder: (context, _) {
|
||||
if (!Stores.setting.useSystemPrimaryColor.fetch()) {
|
||||
UIs.colorSeed = Color(Stores.setting.primaryColor.fetch());
|
||||
return _buildApp(context);
|
||||
|
||||
@@ -280,6 +280,7 @@
|
||||
"suspend": "Suspend",
|
||||
"suspendTip": "Die Suspend-Funktion erfordert Root-Rechte und systemd-Unterstützung.",
|
||||
"switchTo": "Wechseln zu {val}",
|
||||
"sync": "Sync",
|
||||
"syncTip": "Damit einige Änderungen wirksam werden, kann ein Neustart erforderlich sein.",
|
||||
"system": "Systeme",
|
||||
"tag": "Tags",
|
||||
|
||||
@@ -280,6 +280,7 @@
|
||||
"suspend": "Suspend",
|
||||
"suspendTip": "The suspend function requires root privileges and systemd support.",
|
||||
"switchTo": "Switch to {val}",
|
||||
"sync": "Sync",
|
||||
"syncTip": "A restart may be required for some changes to take effect.",
|
||||
"system": "System",
|
||||
"tag": "Tags",
|
||||
|
||||
@@ -280,6 +280,7 @@
|
||||
"suspend": "Suspender",
|
||||
"suspendTip": "La función de suspender necesita permisos de root y soporte de systemd.",
|
||||
"switchTo": "Cambiar a {val}",
|
||||
"sync": "Sincronizar",
|
||||
"syncTip": "Puede que necesites reiniciar para que algunos cambios tengan efecto.",
|
||||
"system": "Sistema",
|
||||
"tag": "Etiqueta",
|
||||
|
||||
@@ -280,6 +280,7 @@
|
||||
"suspend": "Suspendre",
|
||||
"suspendTip": "La fonction de suspension nécessite des privilèges root et le support de systemd.",
|
||||
"switchTo": "Passer à {val}",
|
||||
"sync": "Sync",
|
||||
"syncTip": "Un redémarrage peut être nécessaire pour que certains changements prennent effet.",
|
||||
"system": "Système",
|
||||
"tag": "Étiquettes",
|
||||
|
||||
@@ -280,6 +280,7 @@
|
||||
"suspend": "Suspend",
|
||||
"suspendTip": "Fungsi penangguhan memerlukan hak akses root dan dukungan systemd.",
|
||||
"switchTo": "Beralih ke {val}",
|
||||
"sync": "Sinkronisasi",
|
||||
"syncTip": "Pengaktifan ulang mungkin diperlukan agar beberapa perubahan dapat diterapkan.",
|
||||
"system": "Sistem",
|
||||
"tag": "Tag",
|
||||
|
||||
@@ -280,6 +280,7 @@
|
||||
"suspend": "中断",
|
||||
"suspendTip": "suspend機能はroot権限とsystemdのサポートが必要です。",
|
||||
"switchTo": "{val}に切り替える",
|
||||
"sync": "同期する",
|
||||
"syncTip": "再起動が必要な場合があります。一部の変更はその後に有効になります。",
|
||||
"system": "システム",
|
||||
"tag": "タグ",
|
||||
|
||||
@@ -279,6 +279,7 @@
|
||||
"suspend": "Ophangen",
|
||||
"suspendTip": "De opschortfunctie vereist rootrechten en systemd-ondersteuning.",
|
||||
"switchTo": "Overschakelen naar {val}",
|
||||
"sync": "Sync",
|
||||
"syncTip": "Een herstart kan nodig zijn voor sommige wijzigingen om van kracht te worden.",
|
||||
"system": "Systeem",
|
||||
"tag": "Labels",
|
||||
|
||||
@@ -280,6 +280,7 @@
|
||||
"suspend": "Suspender",
|
||||
"suspendTip": "A função de suspensão requer permissões de root e suporte do systemd.",
|
||||
"switchTo": "Mudar para {val}",
|
||||
"sync": "Sincronizar",
|
||||
"syncTip": "Pode ser necessário reiniciar para algumas mudanças surtirem efeito.",
|
||||
"system": "Sistema",
|
||||
"tag": "Tag",
|
||||
|
||||
@@ -280,6 +280,7 @@
|
||||
"suspend": "приостановить",
|
||||
"suspendTip": "Функция приостановки требует прав root и поддержки systemd.",
|
||||
"switchTo": "переключиться на {val}",
|
||||
"sync": "Синхронизировать",
|
||||
"syncTip": "Возможно, потребуется перезагрузка, чтобы некоторые изменения вступили в силу.",
|
||||
"system": "система",
|
||||
"tag": "тег",
|
||||
|
||||
@@ -280,6 +280,7 @@
|
||||
"suspend": "挂起",
|
||||
"suspendTip": "suspend 功能需要 root 权限及 systemd 支持。",
|
||||
"switchTo": "切换到 {val}",
|
||||
"sync": "同步",
|
||||
"syncTip": "可能需要重新启动,某些更改才能生效。",
|
||||
"system": "系统",
|
||||
"tag": "标签",
|
||||
|
||||
@@ -280,6 +280,7 @@
|
||||
"suspend": "挂起",
|
||||
"suspendTip": "suspend 功能需要 root 權限及 systemd 支持。",
|
||||
"switchTo": "切換到 {val}",
|
||||
"sync": "同步",
|
||||
"syncTip": "可能需要重新啟動,某些更改才能生效。",
|
||||
"system": "系統",
|
||||
"tag": "标签",
|
||||
|
||||
@@ -37,7 +37,7 @@ class EditorPage extends StatefulWidget {
|
||||
});
|
||||
|
||||
@override
|
||||
_EditorPageState createState() => _EditorPageState();
|
||||
State<EditorPage> createState() => _EditorPageState();
|
||||
}
|
||||
|
||||
class _EditorPageState extends State<EditorPage> {
|
||||
|
||||
@@ -14,7 +14,7 @@ class PingPage extends StatefulWidget {
|
||||
const PingPage({super.key});
|
||||
|
||||
@override
|
||||
_PingPageState createState() => _PingPageState();
|
||||
State<PingPage> createState() => _PingPageState();
|
||||
}
|
||||
|
||||
class _PingPageState extends State<PingPage>
|
||||
|
||||
@@ -19,7 +19,7 @@ class PrivateKeyEditPage extends StatefulWidget {
|
||||
final PrivateKeyInfo? pki;
|
||||
|
||||
@override
|
||||
_PrivateKeyEditPageState createState() => _PrivateKeyEditPageState();
|
||||
State<PrivateKeyEditPage> createState() => _PrivateKeyEditPageState();
|
||||
}
|
||||
|
||||
class _PrivateKeyEditPageState extends State<PrivateKeyEditPage> {
|
||||
|
||||
@@ -15,7 +15,7 @@ class PrivateKeysListPage extends StatefulWidget {
|
||||
const PrivateKeysListPage({super.key});
|
||||
|
||||
@override
|
||||
_PrivateKeyListState createState() => _PrivateKeyListState();
|
||||
State<PrivateKeysListPage> createState() => _PrivateKeyListState();
|
||||
}
|
||||
|
||||
class _PrivateKeyListState extends State<PrivateKeysListPage>
|
||||
|
||||
@@ -16,7 +16,7 @@ class ProcessPage extends StatefulWidget {
|
||||
const ProcessPage({super.key, required this.spi});
|
||||
|
||||
@override
|
||||
_ProcessPageState createState() => _ProcessPageState();
|
||||
State<ProcessPage> createState() => _ProcessPageState();
|
||||
}
|
||||
|
||||
class _ProcessPageState extends State<ProcessPage> {
|
||||
|
||||
@@ -19,7 +19,7 @@ final class PvePage extends StatefulWidget {
|
||||
});
|
||||
|
||||
@override
|
||||
_PvePageState createState() => _PvePageState();
|
||||
State<PvePage> createState() => _PvePageState();
|
||||
}
|
||||
|
||||
const _kHorziPadding = 11.0;
|
||||
|
||||
@@ -32,7 +32,7 @@ class ServerDetailPage extends StatefulWidget {
|
||||
final ServerPrivateInfo spi;
|
||||
|
||||
@override
|
||||
_ServerDetailPageState createState() => _ServerDetailPageState();
|
||||
State<ServerDetailPage> createState() => _ServerDetailPageState();
|
||||
}
|
||||
|
||||
class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
|
||||
@@ -20,7 +20,7 @@ class ServerEditPage extends StatefulWidget {
|
||||
final ServerPrivateInfo? spi;
|
||||
|
||||
@override
|
||||
_ServerEditPageState createState() => _ServerEditPageState();
|
||||
State<ServerEditPage> createState() => _ServerEditPageState();
|
||||
}
|
||||
|
||||
class _ServerEditPageState extends State<ServerEditPage> {
|
||||
|
||||
@@ -25,7 +25,7 @@ class ServerPage extends StatefulWidget {
|
||||
const ServerPage({super.key});
|
||||
|
||||
@override
|
||||
_ServerPageState createState() => _ServerPageState();
|
||||
State<ServerPage> createState() => _ServerPageState();
|
||||
}
|
||||
|
||||
class _ServerPageState extends State<ServerPage>
|
||||
|
||||
@@ -23,7 +23,7 @@ class SettingPage extends StatefulWidget {
|
||||
const SettingPage({super.key});
|
||||
|
||||
@override
|
||||
_SettingPageState createState() => _SettingPageState();
|
||||
State<SettingPage> createState() => _SettingPageState();
|
||||
}
|
||||
|
||||
class _SettingPageState extends State<SettingPage> {
|
||||
|
||||
@@ -14,7 +14,7 @@ class IOSSettingsPage extends StatefulWidget {
|
||||
const IOSSettingsPage({super.key});
|
||||
|
||||
@override
|
||||
_IOSSettingsPageState createState() => _IOSSettingsPageState();
|
||||
State<IOSSettingsPage> createState() => _IOSSettingsPageState();
|
||||
}
|
||||
|
||||
class _IOSSettingsPageState extends State<IOSSettingsPage> {
|
||||
@@ -83,7 +83,7 @@ class _IOSSettingsPageState extends State<IOSSettingsPage> {
|
||||
}
|
||||
|
||||
Widget _buildWatchApp() {
|
||||
return FutureWidget<Map<String, dynamic>?>(
|
||||
return FutureWidget(
|
||||
future: () async {
|
||||
if (!await wc.isPaired) {
|
||||
return null;
|
||||
@@ -107,6 +107,7 @@ class _IOSSettingsPageState extends State<IOSSettingsPage> {
|
||||
}
|
||||
return ListTile(
|
||||
title: const Text('Watch app'),
|
||||
subtitle: Text(l10n.edit, style: UIs.textGrey),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right),
|
||||
onTap: () async => _onTapWatchApp(ctx),
|
||||
);
|
||||
|
||||
@@ -8,7 +8,7 @@ class ServerOrderPage extends StatefulWidget {
|
||||
const ServerOrderPage({super.key});
|
||||
|
||||
@override
|
||||
_ServerOrderPageState createState() => _ServerOrderPageState();
|
||||
State<ServerOrderPage> createState() => _ServerOrderPageState();
|
||||
}
|
||||
|
||||
class _ServerOrderPageState extends State<ServerOrderPage> {
|
||||
|
||||
@@ -8,7 +8,7 @@ class SSHVirtKeySettingPage extends StatefulWidget {
|
||||
const SSHVirtKeySettingPage({super.key});
|
||||
|
||||
@override
|
||||
_SSHVirtKeySettingPageState createState() => _SSHVirtKeySettingPageState();
|
||||
State<SSHVirtKeySettingPage> createState() => _SSHVirtKeySettingPageState();
|
||||
}
|
||||
|
||||
class _SSHVirtKeySettingPageState extends State<SSHVirtKeySettingPage> {
|
||||
|
||||
@@ -13,7 +13,7 @@ class SnippetEditPage extends StatefulWidget {
|
||||
final Snippet? snippet;
|
||||
|
||||
@override
|
||||
_SnippetEditPageState createState() => _SnippetEditPageState();
|
||||
State<SnippetEditPage> createState() => _SnippetEditPageState();
|
||||
}
|
||||
|
||||
class _SnippetEditPageState extends State<SnippetEditPage>
|
||||
|
||||
@@ -12,7 +12,7 @@ class SnippetListPage extends StatefulWidget {
|
||||
const SnippetListPage({super.key});
|
||||
|
||||
@override
|
||||
_SnippetListPageState createState() => _SnippetListPageState();
|
||||
State<SnippetListPage> createState() => _SnippetListPageState();
|
||||
}
|
||||
|
||||
class _SnippetListPageState extends State<SnippetListPage> {
|
||||
|
||||
@@ -30,7 +30,7 @@ class SSHPage extends StatefulWidget {
|
||||
final String? initCmd;
|
||||
final bool notFromTab;
|
||||
final Function()? onSessionEnd;
|
||||
final FocusNode? focus;
|
||||
final GlobalKey<TerminalViewState>? terminalKey;
|
||||
|
||||
const SSHPage({
|
||||
super.key,
|
||||
@@ -38,11 +38,11 @@ class SSHPage extends StatefulWidget {
|
||||
this.initCmd,
|
||||
this.notFromTab = true,
|
||||
this.onSessionEnd,
|
||||
this.focus,
|
||||
this.terminalKey,
|
||||
});
|
||||
|
||||
@override
|
||||
_SSHPageState createState() => _SSHPageState();
|
||||
State<SSHPage> createState() => _SSHPageState();
|
||||
}
|
||||
|
||||
const _horizonPadding = 7.0;
|
||||
@@ -52,7 +52,7 @@ class _SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin {
|
||||
late final _terminal = Terminal(inputHandler: _keyboard);
|
||||
final TerminalController _terminalController = TerminalController();
|
||||
final List<List<VirtKey>> _virtKeysList = [];
|
||||
late final _focus = widget.focus ?? FocusNode();
|
||||
late final _termKey = widget.terminalKey ?? GlobalKey<TerminalViewState>();
|
||||
|
||||
late MediaQueryData _media;
|
||||
late TerminalStyle _terminalStyle;
|
||||
@@ -144,8 +144,8 @@ class _SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin {
|
||||
),
|
||||
child: TerminalView(
|
||||
_terminal,
|
||||
key: _termKey,
|
||||
controller: _terminalController,
|
||||
focusNode: _focus,
|
||||
keyboardType: TextInputType.text,
|
||||
enableSuggestions: true,
|
||||
textStyle: _terminalStyle,
|
||||
@@ -282,11 +282,7 @@ class _SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin {
|
||||
Future<void> _doVirtualKeyFunc(VirtualKeyFunc type) async {
|
||||
switch (type) {
|
||||
case VirtualKeyFunc.toggleIME:
|
||||
if (!_focus.hasFocus) {
|
||||
_focus.requestFocus();
|
||||
} else {
|
||||
_focus.unfocus();
|
||||
}
|
||||
_termKey.currentState?.toggleFocus();
|
||||
break;
|
||||
case VirtualKeyFunc.backspace:
|
||||
_terminal.keyInput(TerminalKey.backspace);
|
||||
|
||||
@@ -17,8 +17,8 @@ class SSHTabPage extends StatefulWidget {
|
||||
|
||||
class _SSHTabPageState extends State<SSHTabPage>
|
||||
with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
|
||||
late final _tabMap = <String, ({Widget page, FocusNode? focus})>{
|
||||
l10n.add: (page: _buildAddPage(), focus: null),
|
||||
late final _tabMap = <String, ({Widget page})>{
|
||||
l10n.add: (page: _buildAddPage()),
|
||||
};
|
||||
late var _tabController = TabController(
|
||||
length: _tabMap.length,
|
||||
@@ -38,8 +38,7 @@ class _SSHTabPageState extends State<SSHTabPage>
|
||||
dividerColor: Colors.transparent,
|
||||
onTap: (value) {
|
||||
_fabRN.value = value;
|
||||
final mapKey = _tabMap.keys.elementAt(value);
|
||||
_tabMap[mapKey]?.focus?.requestFocus();
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
),
|
||||
body: _buildBody(),
|
||||
@@ -70,9 +69,12 @@ class _SSHTabPageState extends State<SSHTabPage>
|
||||
IconBtn(
|
||||
icon: Icons.close,
|
||||
onTap: () async {
|
||||
final confirm = await context.showRoundDialog<bool>(
|
||||
title: l10n.attention,
|
||||
child: Text('${l10n.close} SSH ${l10n.conn}($e) ?'),
|
||||
final confirm = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(l10n.attention),
|
||||
content: Text('${l10n.close} SSH ${l10n.conn}($e) ?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => context.pop(true),
|
||||
@@ -84,6 +86,10 @@ class _SSHTabPageState extends State<SSHTabPage>
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
Future.delayed(const Duration(milliseconds: 50),
|
||||
FocusScope.of(context).unfocus);
|
||||
if (confirm != true) {
|
||||
return;
|
||||
}
|
||||
@@ -142,18 +148,15 @@ class _SSHTabPageState extends State<SSHTabPage>
|
||||
}
|
||||
return spi.name;
|
||||
}();
|
||||
final focus = FocusNode();
|
||||
_tabMap[name] = (
|
||||
page: SSHPage(
|
||||
spi: spi,
|
||||
focus: focus,
|
||||
notFromTab: false,
|
||||
onSessionEnd: () {
|
||||
_tabMap.remove(name);
|
||||
_refreshTabs();
|
||||
},
|
||||
),
|
||||
focus: focus,
|
||||
);
|
||||
_refreshTabs();
|
||||
final idx = _tabMap.length - 1;
|
||||
|
||||
@@ -32,7 +32,7 @@ class SftpPage extends StatefulWidget {
|
||||
});
|
||||
|
||||
@override
|
||||
_SftpPageState createState() => _SftpPageState();
|
||||
State<SftpPage> createState() => _SftpPageState();
|
||||
}
|
||||
|
||||
class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
|
||||
@@ -12,7 +12,7 @@ class SftpMissionPage extends StatefulWidget {
|
||||
const SftpMissionPage({super.key});
|
||||
|
||||
@override
|
||||
_SftpMissionPageState createState() => _SftpMissionPageState();
|
||||
State<SftpMissionPage> createState() => _SftpMissionPageState();
|
||||
}
|
||||
|
||||
class _SftpMissionPageState extends State<SftpMissionPage> {
|
||||
|
||||
19
pubspec.lock
19
pubspec.lock
@@ -1434,20 +1434,19 @@ packages:
|
||||
watch_connectivity:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: master
|
||||
resolved-ref: ad5f151a5591b64d384ef22b7855b7a2a53ad3d3
|
||||
url: "https://github.com/lollipopkit/watch_connectivity"
|
||||
source: git
|
||||
version: "0.1.5"
|
||||
name: watch_connectivity
|
||||
sha256: a4257a314601c8448662d1a91421321a2e8a3207937fec4792116f1270ea8766
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
watch_connectivity_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: watch_connectivity_platform_interface
|
||||
sha256: "9074115391bd764c08a17346fcbc4d5c0b555672defbe6928ac648503b54aa9c"
|
||||
sha256: "82e8f165eac779d71bff7f6269a8be530798311cf7f3c33f1594d93468747d11"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.2"
|
||||
version: "0.2.0"
|
||||
watcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1525,8 +1524,8 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: a343bc2fdc11fbc7dbfc1f170692426a6fe01cb9
|
||||
resolved-ref: a343bc2fdc11fbc7dbfc1f170692426a6fe01cb9
|
||||
ref: master
|
||||
resolved-ref: "13a280e77dd077b439af24ad3d054d318ae5df4a"
|
||||
url: "https://github.com/lollipopkit/xterm.dart"
|
||||
source: git
|
||||
version: "4.0.0"
|
||||
|
||||
11
pubspec.yaml
11
pubspec.yaml
@@ -27,7 +27,7 @@ dependencies:
|
||||
intl: ^0.19.0
|
||||
xterm:
|
||||
git:
|
||||
ref: a343bc2fdc11fbc7dbfc1f170692426a6fe01cb9
|
||||
ref: master
|
||||
url: https://github.com/lollipopkit/xterm.dart
|
||||
plain_notification_token: ^0.0.4
|
||||
highlight: ^0.7.0
|
||||
@@ -35,10 +35,7 @@ dependencies:
|
||||
code_text_field: ^1.1.0
|
||||
shared_preferences: ^2.1.1
|
||||
dynamic_color: ^1.6.6
|
||||
watch_connectivity:
|
||||
git:
|
||||
ref: master
|
||||
url: https://github.com/lollipopkit/watch_connectivity
|
||||
watch_connectivity: ^0.2.0
|
||||
#flutter_secure_storage: ^9.0.0
|
||||
xml: ^6.4.2 # for parsing nvidia-smi
|
||||
flutter_displaymode: ^0.6.0
|
||||
@@ -63,8 +60,8 @@ dependency_overrides:
|
||||
# path: ../dartssh2
|
||||
# fl_lib:
|
||||
# path: ../fl_lib
|
||||
# xterm:
|
||||
# path: ../xterm.dart
|
||||
# xterm:
|
||||
# path: ../xterm.dart
|
||||
|
||||
dev_dependencies:
|
||||
flutter_native_splash: ^2.1.6
|
||||
|
||||
Reference in New Issue
Block a user