mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.
This commit is contained in:
@@ -6,24 +6,26 @@ import 'package:toolbox/data/model/app/version_related.dart';
|
||||
import 'package:toolbox/data/res/store.dart';
|
||||
|
||||
enum ServerDetailCards implements VersionRelated {
|
||||
about,
|
||||
cpu,
|
||||
mem,
|
||||
swap,
|
||||
gpu,
|
||||
disk,
|
||||
net,
|
||||
sensor,
|
||||
temp,
|
||||
battery,
|
||||
pve(sinceBuild: 818),
|
||||
custom(sinceBuild: 825),
|
||||
about(Icons.info),
|
||||
cpu(Icons.memory),
|
||||
mem(Bootstrap.memory),
|
||||
swap(Icons.swap_horiz),
|
||||
gpu(Bootstrap.gpu_card),
|
||||
disk(Bootstrap.device_hdd_fill),
|
||||
net(ZondIcons.network),
|
||||
sensor(MingCute.dashboard_4_line),
|
||||
temp(FontAwesome.temperature_empty_solid),
|
||||
battery(Icons.battery_full),
|
||||
pve(BoxIcons.bxs_dashboard, sinceBuild: 818),
|
||||
custom(Icons.code, sinceBuild: 825),
|
||||
;
|
||||
|
||||
@override
|
||||
final int? sinceBuild;
|
||||
|
||||
const ServerDetailCards({this.sinceBuild});
|
||||
final IconData icon;
|
||||
|
||||
const ServerDetailCards(this.icon, {this.sinceBuild});
|
||||
|
||||
static ServerDetailCards? fromName(String str) =>
|
||||
ServerDetailCards.values.firstWhereOrNull((e) => e.name == str);
|
||||
@@ -67,19 +69,4 @@ enum ServerDetailCards implements VersionRelated {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IconData get icon => switch (this) {
|
||||
about => Icons.info,
|
||||
cpu => Icons.memory,
|
||||
mem => Bootstrap.memory,
|
||||
swap => Icons.swap_horiz,
|
||||
gpu => Bootstrap.gpu_card,
|
||||
disk => Icons.storage,
|
||||
net => ZondIcons.network,
|
||||
sensor => MingCute.dashboard_4_line,
|
||||
temp => FontAwesome.temperature_empty_solid,
|
||||
battery => Icons.battery_full,
|
||||
pve => BoxIcons.bxs_dashboard,
|
||||
custom => Icons.code,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../model/app/dynamic_color.dart';
|
||||
|
||||
late Color primaryColor;
|
||||
var primaryColor = const Color(0xff8b2252);
|
||||
|
||||
abstract final class DynamicColors {
|
||||
static const content = DynamicColor(Colors.black87, Colors.white70);
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:after_layout/after_layout.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:icons_plus/icons_plus.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:toolbox/core/channel/bg_run.dart';
|
||||
import 'package:toolbox/core/channel/home_widget.dart';
|
||||
@@ -130,7 +131,7 @@ class _HomePageState extends State<HomePage>
|
||||
title: const Text(BuildData.name),
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: const Icon(Icons.developer_mode, size: 23),
|
||||
icon: const Icon(Icons.developer_mode, size: 21),
|
||||
tooltip: l10n.debug,
|
||||
onPressed: () => AppRoute.debug().go(context),
|
||||
),
|
||||
@@ -177,9 +178,9 @@ class _HomePageState extends State<HomePage>
|
||||
labelBehavior: NavigationDestinationLabelBehavior.onlyShowSelected,
|
||||
destinations: [
|
||||
NavigationDestination(
|
||||
icon: const Icon(Icons.cloud_outlined),
|
||||
icon: const Icon(BoxIcons.bx_server),
|
||||
label: l10n.server,
|
||||
selectedIcon: const Icon(Icons.cloud),
|
||||
selectedIcon: const Icon(BoxIcons.bxs_server),
|
||||
),
|
||||
const NavigationDestination(
|
||||
icon: Icon(Icons.terminal_outlined),
|
||||
@@ -187,14 +188,14 @@ class _HomePageState extends State<HomePage>
|
||||
selectedIcon: Icon(Icons.terminal),
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: const Icon(Icons.snippet_folder_outlined),
|
||||
icon: const Icon(MingCute.file_code_line),
|
||||
label: l10n.snippet,
|
||||
selectedIcon: const Icon(Icons.snippet_folder),
|
||||
selectedIcon: const Icon(MingCute.file_code_fill),
|
||||
),
|
||||
const NavigationDestination(
|
||||
icon: Icon(Icons.network_check_outlined),
|
||||
icon: Icon(MingCute.planet_line),
|
||||
label: 'Ping',
|
||||
selectedIcon: Icon(Icons.network_check),
|
||||
selectedIcon: Icon(MingCute.planet_fill),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -243,17 +244,17 @@ class _HomePageState extends State<HomePage>
|
||||
onTap: () => AppRoute.keyList().go(context),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.file_open),
|
||||
leading: const Icon(BoxIcons.bxs_file_blank),
|
||||
title: Text(l10n.files),
|
||||
onTap: () => AppRoute.localStorage().go(context),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.import_export),
|
||||
leading: const Icon(MingCute.file_import_fill),
|
||||
title: Text(l10n.backup),
|
||||
onTap: () => AppRoute.backup().go(context),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.text_snippet),
|
||||
leading: const Icon(OctIcons.feed_discussion),
|
||||
title: Text('${l10n.about} & ${l10n.feedback}'),
|
||||
onTap: _showAboutDialog,
|
||||
)
|
||||
|
||||
@@ -136,7 +136,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
Widget _buildAbout(ServerStatus ss) {
|
||||
return CardX(
|
||||
child: ExpandTile(
|
||||
leading: const Icon(Icons.computer),
|
||||
leading: const Icon(MingCute.information_fill, size: 20),
|
||||
initiallyExpanded: _getInitExpand(ss.more.entries.length),
|
||||
title: Text(l10n.about),
|
||||
childrenPadding: const EdgeInsets.symmetric(
|
||||
@@ -496,7 +496,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
child: ExpandTile(
|
||||
title: Text(l10n.disk),
|
||||
childrenPadding: const EdgeInsets.only(bottom: 7),
|
||||
leading: const Icon(Icons.storage, size: 17),
|
||||
leading: Icon(ServerDetailCards.disk.icon, size: 17),
|
||||
initiallyExpanded: _getInitExpand(children.length),
|
||||
children: children,
|
||||
),
|
||||
@@ -570,6 +570,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
}
|
||||
return CardX(
|
||||
child: ExpandTile(
|
||||
leading: Icon(ServerDetailCards.net.icon, size: 17),
|
||||
title: Row(
|
||||
children: [
|
||||
Text(l10n.net),
|
||||
@@ -600,7 +601,6 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
],
|
||||
),
|
||||
childrenPadding: const EdgeInsets.only(bottom: 11),
|
||||
leading: const Icon(Icons.device_hub, size: 17),
|
||||
initiallyExpanded: _getInitExpand(children.length),
|
||||
children: children,
|
||||
),
|
||||
|
||||
@@ -99,6 +99,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
},
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
heroTag: 'addServer',
|
||||
onPressed: () => AppRoute.serverEdit().go(context),
|
||||
tooltip: l10n.addAServer,
|
||||
child: const Icon(Icons.add),
|
||||
|
||||
@@ -753,29 +753,36 @@ class _SettingPageState extends State<SettingPage> {
|
||||
final keys = Stores.server.box.keys.toList();
|
||||
keys.removeWhere((element) => element == BoxX.lastModifiedKey);
|
||||
final all = keys.map(
|
||||
(e) => TextButton(
|
||||
onPressed: () => context.showRoundDialog(
|
||||
title: Text(l10n.attention),
|
||||
child: Text(l10n.askContinue(
|
||||
'${l10n.delete} ${l10n.server}($e)',
|
||||
)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Pros.server.delServer(e);
|
||||
ctx.pop();
|
||||
setState(() {});
|
||||
},
|
||||
child: Text(l10n.ok),
|
||||
)
|
||||
],
|
||||
),
|
||||
child: Text(e),
|
||||
),
|
||||
(e) {
|
||||
final name = Pros.server.pick(id: e)?.spi.name;
|
||||
return ListTile(
|
||||
title: Text(name ?? e),
|
||||
subtitle: name != null ? Text(e) : null,
|
||||
onTap: () => context.showRoundDialog(
|
||||
title: Text(l10n.attention),
|
||||
child: Text(l10n.askContinue(
|
||||
'${l10n.delete} ${l10n.server}($e)',
|
||||
)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Pros.server.delServer(e);
|
||||
ctx.pop();
|
||||
setState(() {});
|
||||
},
|
||||
child: Text(l10n.ok),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: all.toList(),
|
||||
return ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxHeight: 377),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: all.toList(),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
@@ -829,7 +836,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
|
||||
Widget _buildServerFuncBtns() {
|
||||
return ExpandTile(
|
||||
leading: const Icon(TeenyIcons.button, size: _kIconSize),
|
||||
leading: const Icon(BoxIcons.bxs_joystick_button, size: _kIconSize),
|
||||
title: Text(l10n.serverFuncBtns),
|
||||
children: [
|
||||
_buildServerFuncBtnsSwitch(),
|
||||
|
||||
@@ -34,7 +34,7 @@ class _SnippetListPageState extends State<SnippetListPage> {
|
||||
return Scaffold(
|
||||
body: _buildBody(),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
heroTag: 'snippet',
|
||||
heroTag: 'snippetAdd',
|
||||
child: const Icon(Icons.add),
|
||||
onPressed: () => AppRoute.snippetEdit().go(context),
|
||||
),
|
||||
|
||||
@@ -47,6 +47,7 @@ class _SSHTabPageState extends State<SSHTabPage>
|
||||
builder: (_, __) {
|
||||
if (_fabRN.value != 0) return const SizedBox();
|
||||
return FloatingActionButton(
|
||||
heroTag: 'sshAddServer',
|
||||
onPressed: () => AppRoute.serverEdit().go(context),
|
||||
tooltip: l10n.addAServer,
|
||||
child: const Icon(Icons.add),
|
||||
|
||||
@@ -125,6 +125,10 @@ void _onTapMoreBtns(
|
||||
);
|
||||
break;
|
||||
case ServerFuncBtn.snippet:
|
||||
if (Pros.snippet.snippets.isEmpty) {
|
||||
context.showSnackBar(l10n.noSavedSnippet);
|
||||
return;
|
||||
}
|
||||
final snippets = await context.showPickWithTagDialog<Snippet>(
|
||||
tags: Pros.snippet.tags,
|
||||
itemsBuilder: (e) {
|
||||
|
||||
Reference in New Issue
Block a user