This commit is contained in:
lollipopkit
2023-05-14 17:39:34 +08:00
parent 5714e26c4d
commit 2161596efc
20 changed files with 341 additions and 144 deletions

View File

@@ -2,8 +2,8 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 306;
static const int build = 310;
static const String engine = "3.10.0";
static const String buildAt = "2023-05-12 22:39:42.911728";
static const int modifications = 5;
static const String buildAt = "2023-05-14 17:02:42.374273";
static const int modifications = 20;
}

View File

@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
/// Font style
const textSize11 = TextStyle(fontSize: 11);
const textSize12Grey = TextStyle(color: Colors.grey, fontSize: 11);
const textSize13 = TextStyle(fontSize: 13);
const textSize13Grey = TextStyle(color: Colors.grey, fontSize: 13);
const textSize15 = TextStyle(fontSize: 15);

View File

@@ -1,6 +1,6 @@
{
"about": "Über",
"aboutThanks": "\nVielen Dank an die folgenden Personen, die zu dieser App beigetragen haben.\n",
"aboutThanks": "Vielen Dank an die folgenden Personen, die daran teilgenommen haben.\n",
"addAServer": "Server hinzufügen",
"addOne": "Hinzufügen",
"addPrivateKey": "Private key hinzufügen",
@@ -19,7 +19,6 @@
"chooseFontFile": "Schriftart auswählen",
"choosePrivateKey": "Private key auswählen",
"clear": "Entfernen",
"clickSee": "Hier klicken",
"close": "Schließen",
"cmd": "Command",
"containerName": "Container Name",
@@ -169,6 +168,7 @@
"versionHaveUpdate": "Gefunden: v1.0.{build}, klicke zum Aktualisieren",
"versionUnknownUpdate": "Aktuell: v1.0.{build}",
"versionUpdated": "v1.0.{build} ist bereits die neueste Version",
"viewErr": "Fehler anzeigen",
"waitConnection": "Bitte warte, bis die Verbindung hergestellt wurde.",
"willTakEeffectImmediately": "Wird sofort angewendet"
}

View File

@@ -1,6 +1,6 @@
{
"about": "About",
"aboutThanks": "\nThanks to the following people who participated in the test.",
"aboutThanks": "Thanks to the following people who participated in.",
"addAServer": "add a server",
"addOne": "Add one",
"addPrivateKey": "Add private key",
@@ -19,7 +19,6 @@
"chooseFontFile": "Choose a font file",
"choosePrivateKey": "Choose private key",
"clear": "Clear",
"clickSee": "Click here",
"close": "Close",
"cmd": "Command",
"containerName": "Container name",
@@ -169,6 +168,7 @@
"versionHaveUpdate": "Found: v1.0.{build}, click to update",
"versionUnknownUpdate": "Current: v1.0.{build}",
"versionUpdated": "Current: v1.0.{build}, is up to date",
"viewErr": "See error",
"waitConnection": "Please wait for the connection to be established.",
"willTakEeffectImmediately": "Will take effect immediately"
}

View File

@@ -1,6 +1,6 @@
{
"about": "关于",
"aboutThanks": "\n感谢以下参与软件测试的各位。",
"aboutThanks": "感谢以下参与的各位。",
"addAServer": "添加服务器",
"addOne": "前去新增",
"addPrivateKey": "添加一个私钥",
@@ -19,7 +19,6 @@
"chooseFontFile": "选择字体文件",
"choosePrivateKey": "选择私钥",
"clear": "清除",
"clickSee": "点击查看",
"close": "关闭",
"cmd": "命令",
"containerName": "容器名",
@@ -169,6 +168,7 @@
"versionHaveUpdate": "找到新版本v1.0.{build}, 点击更新",
"versionUnknownUpdate": "当前v1.0.{build}",
"versionUpdated": "当前v1.0.{build}, 已是最新版本",
"viewErr": "查看错误",
"waitConnection": "请等待连接建立",
"willTakEeffectImmediately": "更改将会立即生效"
}

View File

@@ -115,7 +115,7 @@ class _ServerPageState extends State<ServerPage>
GestureDetector(
child: Padding(
padding: const EdgeInsets.all(13),
child: _buildRealServerCard(si.status, si.spi.name, si.state, si.spi),
child: _buildRealServerCard(si.status, si.state, si.spi),
),
onTap: () => AppRoute(
ServerDetailPage(si.spi.id),
@@ -126,70 +126,17 @@ class _ServerPageState extends State<ServerPage>
);
}
Widget _buildRealServerCard(ServerStatus ss, String serverName,
ServerState cs, ServerPrivateInfo spi) {
Widget _buildRealServerCard(
ServerStatus ss,
ServerState cs,
ServerPrivateInfo spi,
) {
final rootDisk = ss.disk.firstWhere((element) => element.loc == '/');
final topRightStr =
getTopRightStr(cs, ss.cpu.temp, ss.uptime, ss.failedInfo);
final hasError = cs == ServerState.failed && ss.failedInfo != null;
final style = TextStyle(
color: _theme.textTheme.bodyLarge!.color!.withAlpha(100), fontSize: 11);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 7),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Text(
serverName,
style: const TextStyle(
fontWeight: FontWeight.bold, fontSize: 12),
textScaleFactor: 1.0,
),
const Icon(
Icons.keyboard_arrow_right,
size: 17,
color: Colors.grey,
)
],
),
Row(
children: [
hasError
? GestureDetector(
onTap: () => showRoundDialog(
context: context,
title: Text(_s.error),
child: Text(ss.failedInfo ?? _s.unknownError),
actions: [
TextButton(
onPressed: () => copy2Clipboard(
ss.failedInfo ?? _s.unknownError),
child: Text(_s.copy),
)
],
),
child: Text(
_s.clickSee,
style: style,
textScaleFactor: 1.0,
),
)
: Text(topRightStr, style: style, textScaleFactor: 1.0),
const SizedBox(width: 9),
_buildSSHBtn(spi),
_buildMoreBtn(spi),
],
)
],
),
),
_buildServerCardTitle(ss, cs, spi),
const SizedBox(
height: 17,
),
@@ -218,6 +165,71 @@ class _ServerPageState extends State<ServerPage>
);
}
Widget _buildServerCardTitle(
ServerStatus ss,
ServerState cs,
ServerPrivateInfo spi,
) {
final topRightStr =
getTopRightStr(cs, ss.cpu.temp, ss.uptime, ss.failedInfo);
final hasError = cs == ServerState.failed && ss.failedInfo != null;
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 7),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Text(
spi.name,
style:
const TextStyle(fontWeight: FontWeight.bold, fontSize: 12),
textScaleFactor: 1.0,
),
const Icon(
Icons.keyboard_arrow_right,
size: 17,
color: Colors.grey,
)
],
),
Row(
children: [
hasError
? GestureDetector(
onTap: () => showRoundDialog(
context: context,
title: Text(_s.error),
child: Text(ss.failedInfo ?? _s.unknownError),
actions: [
TextButton(
onPressed: () => copy2Clipboard(
ss.failedInfo ?? _s.unknownError),
child: Text(_s.copy),
)
],
),
child: Text(
_s.viewErr,
style: textSize12Grey,
textScaleFactor: 1.0,
),
)
: Text(
topRightStr,
style: textSize12Grey,
textScaleFactor: 1.0,
),
const SizedBox(width: 9),
_buildSSHBtn(spi),
_buildMoreBtn(spi),
],
)
],
),
);
}
Widget _buildSSHBtn(ServerPrivateInfo spi) {
return GestureDetector(
child: const Icon(