opt.: migrate fl_lib

This commit is contained in:
lollipopkit
2024-05-14 22:29:37 +08:00
parent 248430e5b0
commit 04dfede535
136 changed files with 686 additions and 3896 deletions

View File

@@ -1,15 +1,18 @@
import 'package:flutter/material.dart';
abstract class PopMenu {
static PopupMenuItem<T> build<T>(T t, IconData icon, String text) {
static PopupMenuItem<T> build<T>(
T t,
IconData icon,
String text, {
double? iconSize,
}) {
return PopupMenuItem<T>(
value: t,
child: Row(
children: [
Icon(icon),
const SizedBox(
width: 10,
),
Icon(icon, size: iconSize),
const SizedBox(width: 10),
Text(text),
],
),

View File

@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:toolbox/core/extension/context/locale.dart';
import 'package:toolbox/data/model/app/menu/base.dart';
enum ContainerMenu {
start,
@@ -64,10 +63,4 @@ enum ContainerMenu {
// return s.stats;
}
}
PopupMenuItem<ContainerMenu> get widget => PopMenu.build(
this,
icon,
toStr,
);
}

View File

@@ -34,14 +34,14 @@ enum ServerFuncBtn {
snippet,
].map((e) => e.index).toList();
Icon icon([double? sizeDiff]) => switch (this) {
sftp => Icon(Icons.insert_drive_file, size: 15 + (sizeDiff ?? 0)),
snippet => Icon(Icons.code, size: 15 + (sizeDiff ?? 0)),
pkg => Icon(Icons.system_security_update, size: 15 + (sizeDiff ?? 0)),
container => Icon(FontAwesome.docker_brand, size: 14 + (sizeDiff ?? 0)),
process => Icon(Icons.list_alt_outlined, size: 15 + (sizeDiff ?? 0)),
terminal => Icon(Icons.terminal, size: 15 + (sizeDiff ?? 0)),
iperf => Icon(Icons.speed, size: 15 + (sizeDiff ?? 0)),
IconData get icon => switch (this) {
sftp => Icons.insert_drive_file,
snippet => Icons.code,
pkg => Icons.system_security_update,
container => FontAwesome.docker_brand,
process => Icons.list_alt_outlined,
terminal => Icons.terminal,
iperf => Icons.speed,
};
String get toStr => switch (this) {