mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-02-15 04:34:34 +01:00
new: snippet fmt
This commit is contained in:
@@ -46,7 +46,8 @@ enum ContainerErrType {
|
||||
}
|
||||
|
||||
class ContainerErr extends Err<ContainerErrType> {
|
||||
ContainerErr({required super.type, super.message}) : super(from: ErrFrom.docker);
|
||||
ContainerErr({required super.type, super.message})
|
||||
: super(from: ErrFrom.docker);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
||||
18
lib/data/model/app/menu/base.dart
Normal file
18
lib/data/model/app/menu/base.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
abstract class PopMenu {
|
||||
static PopupMenuItem<T> build<T>(T t, IconData icon, String text) {
|
||||
return PopupMenuItem<T>(
|
||||
value: t,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(text),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,49 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:toolbox/core/extension/context/locale.dart';
|
||||
|
||||
enum ServerTabMenu {
|
||||
terminal,
|
||||
sftp,
|
||||
container,
|
||||
process,
|
||||
pkg,
|
||||
//snippet,
|
||||
;
|
||||
|
||||
IconData get icon {
|
||||
switch (this) {
|
||||
case ServerTabMenu.sftp:
|
||||
return Icons.insert_drive_file;
|
||||
//case ServerTabMenuType.snippet:
|
||||
//return Icons.code;
|
||||
case ServerTabMenu.pkg:
|
||||
return Icons.system_security_update;
|
||||
case ServerTabMenu.container:
|
||||
return Icons.view_agenda;
|
||||
case ServerTabMenu.process:
|
||||
return Icons.list_alt_outlined;
|
||||
case ServerTabMenu.terminal:
|
||||
return Icons.terminal;
|
||||
}
|
||||
}
|
||||
|
||||
String get toStr {
|
||||
switch (this) {
|
||||
case ServerTabMenu.sftp:
|
||||
return 'SFTP';
|
||||
//case ServerTabMenuType.snippet:
|
||||
//return l10n.snippet;
|
||||
case ServerTabMenu.pkg:
|
||||
return l10n.pkg;
|
||||
case ServerTabMenu.container:
|
||||
return l10n.container;
|
||||
case ServerTabMenu.process:
|
||||
return l10n.process;
|
||||
case ServerTabMenu.terminal:
|
||||
return l10n.terminal;
|
||||
}
|
||||
}
|
||||
}
|
||||
import 'package:toolbox/data/model/app/menu/base.dart';
|
||||
|
||||
enum ContainerMenu {
|
||||
start,
|
||||
@@ -108,20 +65,9 @@ enum ContainerMenu {
|
||||
}
|
||||
}
|
||||
|
||||
PopupMenuItem<ContainerMenu> get widget => _build(this, icon, toStr);
|
||||
}
|
||||
|
||||
PopupMenuItem<T> _build<T>(T t, IconData icon, String text) {
|
||||
return PopupMenuItem<T>(
|
||||
value: t,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(text),
|
||||
],
|
||||
),
|
||||
);
|
||||
PopupMenuItem<ContainerMenu> get widget => PopMenu.build(
|
||||
this,
|
||||
icon,
|
||||
toStr,
|
||||
);
|
||||
}
|
||||
30
lib/data/model/app/menu/server_func.dart
Normal file
30
lib/data/model/app/menu/server_func.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:toolbox/core/extension/context/locale.dart';
|
||||
|
||||
enum ServerTabMenu {
|
||||
terminal,
|
||||
sftp,
|
||||
container,
|
||||
process,
|
||||
pkg,
|
||||
snippet,
|
||||
;
|
||||
|
||||
IconData get icon => switch (this) {
|
||||
ServerTabMenu.sftp => Icons.insert_drive_file,
|
||||
ServerTabMenu.snippet => Icons.code,
|
||||
ServerTabMenu.pkg => Icons.system_security_update,
|
||||
ServerTabMenu.container => Icons.view_agenda,
|
||||
ServerTabMenu.process => Icons.list_alt_outlined,
|
||||
ServerTabMenu.terminal => Icons.terminal,
|
||||
};
|
||||
|
||||
String get toStr => switch (this) {
|
||||
ServerTabMenu.sftp => 'SFTP',
|
||||
ServerTabMenu.snippet => l10n.snippet,
|
||||
ServerTabMenu.pkg => l10n.pkg,
|
||||
ServerTabMenu.container => l10n.container,
|
||||
ServerTabMenu.process => l10n.process,
|
||||
ServerTabMenu.terminal => l10n.terminal,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user