mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
fix
This commit is contained in:
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:toolbox/core/persistant_store.dart';
|
import 'package:toolbox/core/persistant_store.dart';
|
||||||
import 'package:toolbox/core/utils/platform/base.dart';
|
import 'package:toolbox/core/utils/platform/base.dart';
|
||||||
import 'package:toolbox/data/model/app/menu/server_func.dart';
|
import 'package:toolbox/data/model/app/menu/server_func.dart';
|
||||||
import 'package:toolbox/data/model/ssh/virtual_key.dart';
|
|
||||||
|
|
||||||
import '../model/app/net_view.dart';
|
import '../model/app/net_view.dart';
|
||||||
import '../res/default.dart';
|
import '../res/default.dart';
|
||||||
@@ -141,9 +140,7 @@ class SettingStore extends PersistentStore {
|
|||||||
|
|
||||||
late final sshVirtKeys = listProperty(
|
late final sshVirtKeys = listProperty(
|
||||||
'sshVirtKeys',
|
'sshVirtKeys',
|
||||||
Defaults.sshVirtKeys,
|
Defaults.sshVirtKeys.map((e) => e.index).toList(),
|
||||||
encoder: (val) => val.index,
|
|
||||||
decoder: (val) => VirtKey.values[val],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
late final netViewType = property(
|
late final netViewType = property(
|
||||||
@@ -212,7 +209,7 @@ class SettingStore extends PersistentStore {
|
|||||||
/// Whether collapse UI items by default
|
/// Whether collapse UI items by default
|
||||||
late final collapseUIDefault = property('collapseUIDefault', true);
|
late final collapseUIDefault = property('collapseUIDefault', true);
|
||||||
|
|
||||||
late final serverFuncBtns = listProperty<ServerFuncBtn>(
|
late final serverFuncBtns = listProperty(
|
||||||
'serverBtns',
|
'serverBtns',
|
||||||
[
|
[
|
||||||
ServerFuncBtn.terminal,
|
ServerFuncBtn.terminal,
|
||||||
@@ -221,9 +218,7 @@ class SettingStore extends PersistentStore {
|
|||||||
ServerFuncBtn.process,
|
ServerFuncBtn.process,
|
||||||
ServerFuncBtn.pkg,
|
ServerFuncBtn.pkg,
|
||||||
ServerFuncBtn.snippet,
|
ServerFuncBtn.snippet,
|
||||||
],
|
].map((e) => e.index).toList(),
|
||||||
encoder: (val) => val.index,
|
|
||||||
decoder: (val) => ServerFuncBtn.values[val],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Never show these settings for users
|
// Never show these settings for users
|
||||||
|
|||||||
@@ -29,12 +29,12 @@ class _ServerDetailOrderPageState extends State<ServerFuncBtnsOrderPage> {
|
|||||||
|
|
||||||
Widget _buildBody() {
|
Widget _buildBody() {
|
||||||
final keys_ = Stores.setting.serverFuncBtns.fetch();
|
final keys_ = Stores.setting.serverFuncBtns.fetch();
|
||||||
final keys = <ServerFuncBtn>[];
|
final keys = <int>[];
|
||||||
for (final key in keys_) {
|
for (final key in keys_) {
|
||||||
keys.add(key);
|
keys.add(key);
|
||||||
}
|
}
|
||||||
final disabled =
|
final disabled =
|
||||||
ServerFuncBtn.values.where((e) => !keys.contains(e)).toList();
|
ServerFuncBtn.values.map((e) => e.index).where((e) => !keys.contains(e)).toList();
|
||||||
final allKeys = [...keys, ...disabled];
|
final allKeys = [...keys, ...disabled];
|
||||||
return ReorderableListView.builder(
|
return ReorderableListView.builder(
|
||||||
padding: const EdgeInsets.all(7),
|
padding: const EdgeInsets.all(7),
|
||||||
@@ -43,7 +43,7 @@ class _ServerDetailOrderPageState extends State<ServerFuncBtnsOrderPage> {
|
|||||||
return CardX(
|
return CardX(
|
||||||
key: ValueKey(idx),
|
key: ValueKey(idx),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
title: Text(key.toStr),
|
title: Text(ServerFuncBtn.values[key].toStr),
|
||||||
leading: _buildCheckBox(keys, key, idx, idx < keys.length),
|
leading: _buildCheckBox(keys, key, idx, idx < keys.length),
|
||||||
trailing: isDesktop ? null : const Icon(Icons.drag_handle),
|
trailing: isDesktop ? null : const Icon(Icons.drag_handle),
|
||||||
),
|
),
|
||||||
@@ -62,8 +62,8 @@ class _ServerDetailOrderPageState extends State<ServerFuncBtnsOrderPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCheckBox(
|
Widget _buildCheckBox(
|
||||||
List<ServerFuncBtn> keys,
|
List<int> keys,
|
||||||
ServerFuncBtn key,
|
int key,
|
||||||
int idx,
|
int idx,
|
||||||
bool value,
|
bool value,
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -30,21 +30,22 @@ class _SSHVirtKeySettingPageState extends State<SSHVirtKeySettingPage> {
|
|||||||
|
|
||||||
Widget _buildBody() {
|
Widget _buildBody() {
|
||||||
final keys_ = Stores.setting.sshVirtKeys.fetch();
|
final keys_ = Stores.setting.sshVirtKeys.fetch();
|
||||||
final keys = <VirtKey>[];
|
final keys = <int>[];
|
||||||
for (final key in keys_) {
|
for (final key in keys_) {
|
||||||
keys.add(key);
|
keys.add(key);
|
||||||
}
|
}
|
||||||
final disabled = VirtKey.values.where((e) => !keys.contains(e)).toList();
|
final disabled = VirtKey.values.map((e) => e.index).where((e) => !keys.contains(e)).toList();
|
||||||
final allKeys = [...keys, ...disabled];
|
final allKeys = [...keys, ...disabled];
|
||||||
return ReorderableListView.builder(
|
return ReorderableListView.builder(
|
||||||
padding: const EdgeInsets.all(7),
|
padding: const EdgeInsets.all(7),
|
||||||
itemBuilder: (_, idx) {
|
itemBuilder: (_, idx) {
|
||||||
final key = allKeys[idx];
|
final key = allKeys[idx];
|
||||||
final help = key.help;
|
final item = VirtKey.values[key];
|
||||||
|
final help = item.help;
|
||||||
return CardX(
|
return CardX(
|
||||||
key: ValueKey(idx),
|
key: ValueKey(idx),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
title: _buildTitle(key),
|
title: _buildTitle(item),
|
||||||
subtitle: help == null ? null : Text(help, style: UIs.textGrey),
|
subtitle: help == null ? null : Text(help, style: UIs.textGrey),
|
||||||
leading: _buildCheckBox(keys, key, idx, idx < keys.length),
|
leading: _buildCheckBox(keys, key, idx, idx < keys.length),
|
||||||
trailing: isDesktop ? null : const Icon(Icons.drag_handle),
|
trailing: isDesktop ? null : const Icon(Icons.drag_handle),
|
||||||
@@ -75,7 +76,7 @@ class _SSHVirtKeySettingPageState extends State<SSHVirtKeySettingPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCheckBox(List<VirtKey> keys, VirtKey key, int idx, bool value) {
|
Widget _buildCheckBox(List<int> keys, int key, int idx, bool value) {
|
||||||
return Checkbox(
|
return Checkbox(
|
||||||
value: value,
|
value: value,
|
||||||
onChanged: (val) {
|
onChanged: (val) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import 'package:toolbox/core/extension/context/locale.dart';
|
|||||||
import 'package:toolbox/core/extension/context/snackbar.dart';
|
import 'package:toolbox/core/extension/context/snackbar.dart';
|
||||||
import 'package:toolbox/core/extension/ssh_client.dart';
|
import 'package:toolbox/core/extension/ssh_client.dart';
|
||||||
import 'package:toolbox/core/extension/uint8list.dart';
|
import 'package:toolbox/core/extension/uint8list.dart';
|
||||||
|
import 'package:toolbox/core/extension/widget.dart';
|
||||||
import 'package:toolbox/core/utils/platform/base.dart';
|
import 'package:toolbox/core/utils/platform/base.dart';
|
||||||
import 'package:toolbox/core/utils/platform/path.dart';
|
import 'package:toolbox/core/utils/platform/path.dart';
|
||||||
import 'package:toolbox/data/model/app/menu/server_func.dart';
|
import 'package:toolbox/data/model/app/menu/server_func.dart';
|
||||||
@@ -17,6 +18,7 @@ import 'package:toolbox/data/model/server/snippet.dart';
|
|||||||
import 'package:toolbox/data/res/path.dart';
|
import 'package:toolbox/data/res/path.dart';
|
||||||
import 'package:toolbox/data/res/provider.dart';
|
import 'package:toolbox/data/res/provider.dart';
|
||||||
import 'package:toolbox/data/res/store.dart';
|
import 'package:toolbox/data/res/store.dart';
|
||||||
|
import 'package:toolbox/data/res/ui.dart';
|
||||||
|
|
||||||
import '../../core/route.dart';
|
import '../../core/route.dart';
|
||||||
import '../../core/utils/server.dart';
|
import '../../core/utils/server.dart';
|
||||||
@@ -67,43 +69,30 @@ class ServerFuncBtns extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// return Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
// children: ServerTabMenuType.values
|
|
||||||
// .map(
|
|
||||||
// (e) => Stores.setting.serverFuncBtnsDisplayName.fetch()
|
|
||||||
// ? Column(
|
|
||||||
// mainAxisSize: MainAxisSize.min,
|
|
||||||
// children: [
|
|
||||||
// IconButton(
|
|
||||||
// onPressed: () => _onTapMoreBtns(e, spi, context),
|
|
||||||
// padding: EdgeInsets.zero,
|
|
||||||
// tooltip: e.name,
|
|
||||||
// icon: Icon(e.icon, size: iconSize ?? 15),
|
|
||||||
// ),
|
|
||||||
// Text(e.toStr, style: UIs.textSize9Grey)
|
|
||||||
// ],
|
|
||||||
// )
|
|
||||||
// : IconButton(
|
|
||||||
// onPressed: () => _onTapMoreBtns(e, spi, context),
|
|
||||||
// padding: EdgeInsets.zero,
|
|
||||||
// tooltip: e.name,
|
|
||||||
// icon: Icon(e.icon, size: iconSize ?? 15),
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
// .toList(),
|
|
||||||
// );
|
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: Stores.setting.serverFuncBtns
|
children: Stores.setting.serverFuncBtns
|
||||||
.fetch()
|
.fetch()
|
||||||
|
.map((e) => ServerFuncBtn.values[e])
|
||||||
.map(
|
.map(
|
||||||
(e) => IconButton(
|
(e) => Stores.setting.moveOutServerTabFuncBtns.fetch()
|
||||||
onPressed: () => _onTapMoreBtns(e, spi, context),
|
? IconButton(
|
||||||
padding: EdgeInsets.zero,
|
onPressed: () => _onTapMoreBtns(e, spi, context),
|
||||||
tooltip: e.toStr,
|
padding: EdgeInsets.zero,
|
||||||
icon: Icon(e.icon, size: iconSize ?? 15),
|
tooltip: e.toStr,
|
||||||
),
|
icon: Icon(e.icon, size: iconSize ?? 15),
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => _onTapMoreBtns(e, spi, context),
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
icon: Icon(e.icon, size: iconSize ?? 15),
|
||||||
|
),
|
||||||
|
Text(e.toStr, style: UIs.text11Grey)
|
||||||
|
],
|
||||||
|
).padding(const EdgeInsets.only(bottom: 13)),
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user