new: docker icon

This commit is contained in:
lollipopkit
2024-03-20 14:24:05 +08:00
parent cedade1d01
commit d5ce11c788
10 changed files with 111 additions and 44 deletions

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:icons_plus/icons_plus.dart';
import 'package:toolbox/core/extension/context/locale.dart';
part 'server_func.g.dart';
@@ -24,15 +25,25 @@ enum ServerFuncBtn {
pve,
;
IconData get icon => switch (this) {
sftp => Icons.insert_drive_file,
snippet => Icons.code,
pkg => Icons.system_security_update,
container => Icons.view_agenda,
process => Icons.list_alt_outlined,
terminal => Icons.terminal,
iperf => Icons.speed,
pve => Icons.computer,
static const defaultFuncs = [
terminal,
sftp,
container,
process,
pkg,
snippet,
pve,
];
Icon get icon => switch (this) {
sftp => const Icon(Icons.insert_drive_file, size: 15),
snippet => const Icon(Icons.code, size: 15),
pkg => const Icon(Icons.system_security_update, size: 15),
container => const Icon(FontAwesome.docker_brand, size: 14),
process => const Icon(Icons.list_alt_outlined, size: 15),
terminal => const Icon(Icons.terminal, size: 15),
iperf => const Icon(Icons.speed, size: 15),
pve => const Icon(FontAwesome.server_solid, size: 13),
};
String get toStr => switch (this) {

View File

@@ -102,7 +102,8 @@ final class PveProvider extends ChangeNotifier {
try {
final resp = await session.get('$addr/api2/json/cluster/resources');
final res = resp.data['data'] as List;
final result = await Computer.shared.start(PveRes.parse, (res, data.value));
final result =
await Computer.shared.start(PveRes.parse, (res, data.value));
data.value = result;
} catch (e) {
Loggers.app.warning('PVE list failed', e);

View File

@@ -2,9 +2,9 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 811;
static const int build = 817;
static const String engine = "3.19.3";
static const String buildAt = "2024-03-16 16:31:54";
static const int modifications = 6;
static const String buildAt = "2024-03-19 16:44:04";
static const int modifications = 4;
static const int script = 41;
}

View File

@@ -116,7 +116,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
itemCount: buildFuncs ? _cardsOrder.length + 1 : _cardsOrder.length,
itemBuilder: (context, index) {
if (index == 0 && buildFuncs) {
return ServerFuncBtns(spi: widget.spi, iconSize: 19);
return ServerFuncBtns(spi: widget.spi);
}
if (buildFuncs) index--;
return _cardBuildMap[_cardsOrder[index]]?.call(si.status);

View File

@@ -41,7 +41,7 @@ class ServerFuncBtnsTopRight extends StatelessWidget {
value: e,
child: Row(
children: [
Icon(e.icon),
e.icon,
const SizedBox(
width: 10,
),
@@ -60,11 +60,9 @@ class ServerFuncBtns extends StatelessWidget {
const ServerFuncBtns({
super.key,
required this.spi,
this.iconSize,
});
final ServerPrivateInfo spi;
final double? iconSize;
@override
Widget build(BuildContext context) {
@@ -86,7 +84,7 @@ class ServerFuncBtns extends StatelessWidget {
onPressed: () => _onTapMoreBtns(e, spi, context),
padding: EdgeInsets.zero,
tooltip: e.toStr,
icon: Icon(e.icon, size: iconSize ?? 15),
icon: e.icon,
)
: Padding(
padding: const EdgeInsets.only(bottom: 13),
@@ -96,7 +94,7 @@ class ServerFuncBtns extends StatelessWidget {
IconButton(
onPressed: () => _onTapMoreBtns(e, spi, context),
padding: EdgeInsets.zero,
icon: Icon(e.icon, size: iconSize ?? 15),
icon: e.icon,
),
Text(e.toStr, style: UIs.text11Grey)
],