fix & opt.

fix: net iface parse
opt: `ssh` page auto unpress `ctrl or alt` after call
opt: enable translation for menu
opt: add confirm to `docker` page
This commit is contained in:
LollipopKit
2023-01-29 17:39:27 +08:00
parent f3c670d82c
commit 7c0e01d0d5
10 changed files with 122 additions and 51 deletions

View File

@@ -1,27 +1,7 @@
import 'package:flutter/material.dart';
import 'package:toolbox/data/res/color.dart';
class DropdownBtnItem {
final String text;
final IconData icon;
const DropdownBtnItem({
required this.text,
required this.icon,
});
Widget get build => Row(
children: [
Icon(icon, color: primaryColor),
const SizedBox(
width: 10,
),
Text(
text,
),
],
);
}
import '../../generated/l10n.dart';
import '../../view/widget/dropdown_menu.dart';
class ServerTabMenuItems {
static const List<DropdownBtnItem> firstItems = [sftp, snippet, pkg, docker];
@@ -42,3 +22,22 @@ class DockerMenuItems {
static const start = DropdownBtnItem(text: 'Start', icon: Icons.play_arrow);
static const stop = DropdownBtnItem(text: 'Stop', icon: Icons.stop);
}
String getDropdownBtnText(S s, String text) {
switch (text) {
case 'Snippet':
return s.snippet;
case 'Pkg':
return s.pkgManage;
case 'Remove':
return s.delete;
case 'Start':
return s.start;
case 'Stop':
return s.stop;
case 'Edit':
return s.edit;
default:
return text;
}
}

View File

@@ -6,12 +6,12 @@ import '../model/server/server_status.dart';
import '../model/server/tcp_status.dart';
get _initMemory => Memory(
total: 1,
used: 0,
free: 1,
cache: 0,
avail: 1,
);
total: 1,
used: 0,
free: 1,
cache: 0,
avail: 1,
);
get _initOneTimeCpuStatus => OneTimeCpuStatus(
'cpu',
0,
@@ -45,4 +45,4 @@ get initStatus => ServerStatus(
[DiskInfo('/', '/', 0, '0', '0', '0')],
TcpStatus(0, 0, 0, 0),
initNetSpeed,
);
);