mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.: ssh terminal ux (#778)
This commit is contained in:
@@ -9,8 +9,8 @@ extension _App on _AppSettingsPageState {
|
|||||||
_buildAppColor(),
|
_buildAppColor(),
|
||||||
_buildCheckUpdate(),
|
_buildCheckUpdate(),
|
||||||
PlatformPublicSettings.buildBioAuth(),
|
PlatformPublicSettings.buildBioAuth(),
|
||||||
_buildAppMore(),
|
|
||||||
if (specific != null) specific,
|
if (specific != null) specific,
|
||||||
|
_buildAppMore(),
|
||||||
];
|
];
|
||||||
|
|
||||||
return Column(children: children.map((e) => e.cardx).toList());
|
return Column(children: children.map((e) => e.cardx).toList());
|
||||||
@@ -200,20 +200,6 @@ extension _App on _AppSettingsPageState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTermFontSize() {
|
|
||||||
return ListTile(
|
|
||||||
leading: const Icon(MingCute.font_size_line),
|
|
||||||
// title: Text(l10n.fontSize),
|
|
||||||
// subtitle: Text(l10n.termFontSizeTip, style: UIs.textGrey),
|
|
||||||
title: TipText(l10n.fontSize, l10n.termFontSizeTip),
|
|
||||||
trailing: ValBuilder(
|
|
||||||
listenable: _setting.termFontSize.listenable(),
|
|
||||||
builder: (val) => Text(val.toString(), style: UIs.text15),
|
|
||||||
),
|
|
||||||
onTap: () => _showFontSizeDialog(_setting.termFontSize),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildLocale() {
|
Widget _buildLocale() {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: const Icon(IonIcons.language),
|
leading: const Icon(IonIcons.language),
|
||||||
|
|||||||
@@ -90,23 +90,21 @@ extension _Editor on _AppSettingsPageState {
|
|||||||
title: Text(l10n.fontSize),
|
title: Text(l10n.fontSize),
|
||||||
trailing: ValBuilder(
|
trailing: ValBuilder(
|
||||||
listenable: _setting.editorFontSize.listenable(),
|
listenable: _setting.editorFontSize.listenable(),
|
||||||
builder: (val) => Text(
|
builder: (val) => Text(val.toString(), style: UIs.text15),
|
||||||
val.toString(),
|
|
||||||
style: UIs.text15,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
onTap: () => _showFontSizeDialog(_setting.editorFontSize),
|
onTap: () => _showFontSizeDialog(_setting.editorFontSize),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showFontSizeDialog(HiveProp<double> property) {
|
void _showFontSizeDialog(HiveProp<double> property) {
|
||||||
|
final ctrl = TextEditingController(text: property.fetch().toString());
|
||||||
void onSave() {
|
void onSave() {
|
||||||
context.pop();
|
context.pop();
|
||||||
final fontSize = double.tryParse(_editorTextSizeCtrl.text);
|
final fontSize = double.tryParse(ctrl.text);
|
||||||
if (fontSize == null) {
|
if (fontSize == null) {
|
||||||
context.showRoundDialog(
|
context.showRoundDialog(
|
||||||
title: libL10n.fail,
|
title: libL10n.fail,
|
||||||
child: Text('Parsed failed: ${_editorTextSizeCtrl.text}'),
|
child: Text('Parsed failed: ${ctrl.text}'),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -116,7 +114,7 @@ extension _Editor on _AppSettingsPageState {
|
|||||||
context.showRoundDialog(
|
context.showRoundDialog(
|
||||||
title: l10n.fontSize,
|
title: l10n.fontSize,
|
||||||
child: Input(
|
child: Input(
|
||||||
controller: _editorTextSizeCtrl,
|
controller: ctrl,
|
||||||
autoFocus: true,
|
autoFocus: true,
|
||||||
type: TextInputType.number,
|
type: TextInputType.number,
|
||||||
icon: Icons.font_download,
|
icon: Icons.font_download,
|
||||||
|
|||||||
@@ -79,6 +79,18 @@ extension _SSH on _AppSettingsPageState {
|
|||||||
RNodes.app.notify();
|
RNodes.app.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildTermFontSize() {
|
||||||
|
return ListTile(
|
||||||
|
leading: const Icon(MingCute.font_size_line),
|
||||||
|
title: TipText(l10n.fontSize, l10n.termFontSizeTip),
|
||||||
|
trailing: ValBuilder(
|
||||||
|
listenable: _setting.termFontSize.listenable(),
|
||||||
|
builder: (val) => Text(val.toString(), style: UIs.text15),
|
||||||
|
),
|
||||||
|
onTap: () => _showFontSizeDialog(_setting.termFontSize),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _pickBgImage() async {
|
Future<void> _pickBgImage() async {
|
||||||
final path = await Pfs.pickFilePath();
|
final path = await Pfs.pickFilePath();
|
||||||
if (path == null) return;
|
if (path == null) return;
|
||||||
|
|||||||
@@ -111,8 +111,6 @@ final class _AppSettingsPageState extends State<AppSettingsPage> {
|
|||||||
late final _sshOpacityCtrl = TextEditingController(text: _setting.sshBgOpacity.fetch().toString());
|
late final _sshOpacityCtrl = TextEditingController(text: _setting.sshBgOpacity.fetch().toString());
|
||||||
late final _sshBlurCtrl = TextEditingController(text: _setting.sshBlurRadius.fetch().toString());
|
late final _sshBlurCtrl = TextEditingController(text: _setting.sshBlurRadius.fetch().toString());
|
||||||
late final _textScalerCtrl = TextEditingController(text: _setting.textFactor.toString());
|
late final _textScalerCtrl = TextEditingController(text: _setting.textFactor.toString());
|
||||||
|
|
||||||
late final _editorTextSizeCtrl = TextEditingController(text: _setting.editorFontSize.get().toString());
|
|
||||||
late final _serverLogoCtrl = TextEditingController(text: _setting.serverLogoUrl.fetch());
|
late final _serverLogoCtrl = TextEditingController(text: _setting.serverLogoUrl.fetch());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ extension _Init on SSHPageState {
|
|||||||
actions: Btn.ok(
|
actions: Btn.ok(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
contextSafe?.pop(); // Can't use tear-drop here
|
contextSafe?.pop(); // Can't use tear-drop here
|
||||||
|
contextSafe?.pop(); // Pop the SSHPage
|
||||||
},
|
},
|
||||||
).toList,
|
).toList,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -64,10 +64,11 @@ class SSHPage extends StatefulWidget {
|
|||||||
|
|
||||||
const _horizonPadding = 7.0;
|
const _horizonPadding = 7.0;
|
||||||
|
|
||||||
class SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin, AfterLayoutMixin {
|
class SSHPageState extends State<SSHPage>
|
||||||
|
with AutomaticKeepAliveClientMixin, AfterLayoutMixin, TickerProviderStateMixin {
|
||||||
final _keyboard = VirtKeyProvider();
|
final _keyboard = VirtKeyProvider();
|
||||||
late final _terminal = Terminal(inputHandler: _keyboard);
|
late final _terminal = Terminal(inputHandler: _keyboard);
|
||||||
final TerminalController _terminalController = TerminalController();
|
late final TerminalController _terminalController = TerminalController(vsync: this);
|
||||||
final List<List<VirtKey>> _virtKeysList = [];
|
final List<List<VirtKey>> _virtKeysList = [];
|
||||||
late final _termKey = widget.args.terminalKey ?? GlobalKey<TerminalViewState>();
|
late final _termKey = widget.args.terminalKey ?? GlobalKey<TerminalViewState>();
|
||||||
|
|
||||||
@@ -156,8 +157,9 @@ class SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin, Af
|
|||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: CustomAppBar(
|
appBar: CustomAppBar(
|
||||||
|
leading: BackButton(onPressed: context.pop),
|
||||||
title: Text(widget.args.spi.name),
|
title: Text(widget.args.spi.name),
|
||||||
actions: [_buildCopyBtn, _buildKillBtn],
|
actions: [_buildCopyBtn],
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
),
|
),
|
||||||
backgroundColor: hasBg ? Colors.transparent : _terminalTheme.background,
|
backgroundColor: hasBg ? Colors.transparent : _terminalTheme.background,
|
||||||
@@ -310,9 +312,10 @@ class SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin, Af
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget get _buildCopyBtn {
|
Widget get _buildCopyBtn {
|
||||||
return Btn.icon(
|
return IconButton(
|
||||||
icon: Icon(MingCute.copy_2_fill),
|
icon: Icon(MingCute.copy_2_fill),
|
||||||
onTap: () {
|
tooltip: libL10n.copy,
|
||||||
|
onPressed: () {
|
||||||
final selected = terminalSelected;
|
final selected = terminalSelected;
|
||||||
if (selected == null || selected.isEmpty) {
|
if (selected == null || selected.isEmpty) {
|
||||||
return;
|
return;
|
||||||
@@ -322,17 +325,6 @@ class SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin, Af
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget get _buildKillBtn {
|
|
||||||
return Btn.icon(
|
|
||||||
icon: Icon(MingCute.close_circle_fill),
|
|
||||||
onTap: () {
|
|
||||||
if (_client == null) return;
|
|
||||||
_client!.close();
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get wantKeepAlive => true;
|
bool get wantKeepAlive => true;
|
||||||
|
|
||||||
|
|||||||
12
pubspec.lock
12
pubspec.lock
@@ -496,9 +496,11 @@ packages:
|
|||||||
fl_lib:
|
fl_lib:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "../fl_lib"
|
path: "."
|
||||||
relative: true
|
ref: "v1.0.319"
|
||||||
source: path
|
resolved-ref: d45c47a24303a2e937fee6753f1d0755805b8483
|
||||||
|
url: "https://github.com/lppcg/fl_lib"
|
||||||
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
flutter:
|
flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
@@ -1772,8 +1774,8 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: "v1.0.587"
|
ref: "v1.0.588"
|
||||||
resolved-ref: "0f5027286380e3829ad2696d69d5a1ecf68eb875"
|
resolved-ref: d28207b988b5bed38c799618b9c412486592c689
|
||||||
url: "https://github.com/lollipopkit/xterm.dart"
|
url: "https://github.com/lollipopkit/xterm.dart"
|
||||||
source: git
|
source: git
|
||||||
version: "4.0.0"
|
version: "4.0.0"
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ dependencies:
|
|||||||
xterm:
|
xterm:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/lollipopkit/xterm.dart
|
url: https://github.com/lollipopkit/xterm.dart
|
||||||
ref: v1.0.587
|
ref: v1.0.588
|
||||||
computer:
|
computer:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/lollipopkit/dart_computer
|
url: https://github.com/lollipopkit/dart_computer
|
||||||
@@ -62,7 +62,7 @@ dependencies:
|
|||||||
fl_lib:
|
fl_lib:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/lppcg/fl_lib
|
url: https://github.com/lppcg/fl_lib
|
||||||
ref: v1.0.318
|
ref: v1.0.319
|
||||||
|
|
||||||
dependency_overrides:
|
dependency_overrides:
|
||||||
# webdav_client_plus:
|
# webdav_client_plus:
|
||||||
|
|||||||
Reference in New Issue
Block a user