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