mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-02-07 08:44:48 +01:00
feat: only one line ssh virt keys (#332)
This commit is contained in:
@@ -2,11 +2,13 @@ import 'package:flutter/material.dart';
|
||||
import 'package:toolbox/core/extension/context/locale.dart';
|
||||
import 'package:toolbox/core/extension/context/snackbar.dart';
|
||||
import 'package:toolbox/core/extension/order.dart';
|
||||
import 'package:toolbox/core/extension/widget.dart';
|
||||
import 'package:toolbox/core/utils/platform/base.dart';
|
||||
import 'package:toolbox/data/model/ssh/virtual_key.dart';
|
||||
import 'package:toolbox/data/res/store.dart';
|
||||
import 'package:toolbox/data/res/ui.dart';
|
||||
import 'package:toolbox/view/widget/cardx.dart';
|
||||
import 'package:toolbox/view/widget/store_switch.dart';
|
||||
|
||||
import '../../../widget/appbar.dart';
|
||||
|
||||
@@ -26,7 +28,22 @@ class _SSHVirtKeySettingPageState extends State<SSHVirtKeySettingPage> {
|
||||
appBar: CustomAppBar(
|
||||
title: Text(l10n.editVirtKeys),
|
||||
),
|
||||
body: _buildBody(),
|
||||
body: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(7),
|
||||
child: _buildOneLineVirtKey().card,
|
||||
),
|
||||
Expanded(child: _buildBody()),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildOneLineVirtKey() {
|
||||
return ListTile(
|
||||
title: Text(l10n.onlyOneLine),
|
||||
trailing: StoreSwitch(prop: Stores.setting.horizonVirtKey),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ class _SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin {
|
||||
late TerminalTheme _terminalTheme;
|
||||
double _virtKeyWidth = 0;
|
||||
double _virtKeysHeight = 0;
|
||||
late final _horizonVirtKeys = Stores.setting.horizonVirtKey.fetch();
|
||||
|
||||
bool _isDark = false;
|
||||
Timer? _virtKeyLongPressTimer;
|
||||
@@ -103,7 +104,11 @@ class _SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin {
|
||||
// Because the virtual keyboard only displayed on mobile devices
|
||||
if (isMobile) {
|
||||
_virtKeyWidth = _media.size.width / 7;
|
||||
_virtKeysHeight = _media.size.height * 0.043 * _virtKeysList.length;
|
||||
if (_horizonVirtKeys) {
|
||||
_virtKeysHeight = _media.size.height * 0.043;
|
||||
} else {
|
||||
_virtKeysHeight = _media.size.height * 0.043 * _virtKeysList.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,6 +185,14 @@ class _SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin {
|
||||
}
|
||||
|
||||
Widget _buildVirtualKey() {
|
||||
if (_horizonVirtKeys) {
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: _virtKeysList.expand((e) => e).map(_buildVirtKeyItem).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
final rows = _virtKeysList
|
||||
.map((e) => Row(children: e.map((f) => _buildVirtKeyItem(f)).toList()))
|
||||
.toList();
|
||||
|
||||
Reference in New Issue
Block a user