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