mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
feat. & opt.
switch for distribution logo opt. for server detail page
This commit is contained in:
@@ -76,7 +76,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
profile {
|
profile {
|
||||||
applicationIdSuffix '.profile'
|
applicationIdSuffix '.debug'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,11 +1,12 @@
|
|||||||
PODS:
|
PODS:
|
||||||
- countly_flutter (22.02.0):
|
- countly_flutter (22.09.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
- Flutter (1.0.0)
|
- Flutter (1.0.0)
|
||||||
- flutter_native_splash (0.0.1):
|
- flutter_native_splash (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- path_provider_ios (0.0.1):
|
- path_provider_foundation (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- FlutterMacOS
|
||||||
- r_upgrade (0.0.1):
|
- r_upgrade (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- share_plus (0.0.1):
|
- share_plus (0.0.1):
|
||||||
@@ -17,7 +18,7 @@ DEPENDENCIES:
|
|||||||
- countly_flutter (from `.symlinks/plugins/countly_flutter/ios`)
|
- countly_flutter (from `.symlinks/plugins/countly_flutter/ios`)
|
||||||
- Flutter (from `Flutter`)
|
- Flutter (from `Flutter`)
|
||||||
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
|
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
|
||||||
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
|
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
|
||||||
- r_upgrade (from `.symlinks/plugins/r_upgrade/ios`)
|
- r_upgrade (from `.symlinks/plugins/r_upgrade/ios`)
|
||||||
- share_plus (from `.symlinks/plugins/share_plus/ios`)
|
- share_plus (from `.symlinks/plugins/share_plus/ios`)
|
||||||
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
||||||
@@ -29,8 +30,8 @@ EXTERNAL SOURCES:
|
|||||||
:path: Flutter
|
:path: Flutter
|
||||||
flutter_native_splash:
|
flutter_native_splash:
|
||||||
:path: ".symlinks/plugins/flutter_native_splash/ios"
|
:path: ".symlinks/plugins/flutter_native_splash/ios"
|
||||||
path_provider_ios:
|
path_provider_foundation:
|
||||||
:path: ".symlinks/plugins/path_provider_ios/ios"
|
:path: ".symlinks/plugins/path_provider_foundation/ios"
|
||||||
r_upgrade:
|
r_upgrade:
|
||||||
:path: ".symlinks/plugins/r_upgrade/ios"
|
:path: ".symlinks/plugins/r_upgrade/ios"
|
||||||
share_plus:
|
share_plus:
|
||||||
@@ -39,13 +40,13 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
countly_flutter: c1c0f790841565e956256c4d2e11aee73c517da5
|
countly_flutter: 135f1a4930f8e26ba223a14201d3f265ea7b4c83
|
||||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||||
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
|
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
|
||||||
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
|
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852
|
||||||
r_upgrade: 44d715c61914cce3d01ea225abffe894fd51c114
|
r_upgrade: 44d715c61914cce3d01ea225abffe894fd51c114
|
||||||
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
|
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
|
||||||
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de
|
url_launcher_ios: ae1517e5e344f5544fb090b079e11f399dfbe4d2
|
||||||
|
|
||||||
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
|
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
archiveVersion = 1;
|
archiveVersion = 1;
|
||||||
classes = {
|
classes = {
|
||||||
};
|
};
|
||||||
objectVersion = 51;
|
objectVersion = 54;
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
@@ -199,6 +199,7 @@
|
|||||||
/* Begin PBXShellScriptBuildPhase section */
|
/* Begin PBXShellScriptBuildPhase section */
|
||||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
alwaysOutOfDate = 1;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
);
|
);
|
||||||
@@ -213,6 +214,7 @@
|
|||||||
};
|
};
|
||||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
alwaysOutOfDate = 1;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -48,5 +48,7 @@
|
|||||||
</array>
|
</array>
|
||||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||||
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -8,7 +8,6 @@ enum Dist {
|
|||||||
wrt,
|
wrt,
|
||||||
armbian,
|
armbian,
|
||||||
arch,
|
arch,
|
||||||
/// Rocky Linux
|
|
||||||
rocky;
|
rocky;
|
||||||
|
|
||||||
String? get iconPath {
|
String? get iconPath {
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
class BuildData {
|
class BuildData {
|
||||||
static const String name = "ServerBox";
|
static const String name = "ServerBox";
|
||||||
static const int build = 176;
|
static const int build = 183;
|
||||||
static const String engine =
|
static const String engine =
|
||||||
"Flutter 3.3.9 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision b8f7f1f986 (7 weeks ago) • 2022-11-23 06:43:51 +0900\nEngine • revision 8f2221fbef\nTools • Dart 2.18.5 • DevTools 2.15.0\n";
|
"Flutter 3.7.0 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision b06b8b2710 (4 days ago) • 2023-01-23 16:55:55 -0800\nEngine • revision b24591ed32\nTools • Dart 2.19.0 • DevTools 2.20.1\n";
|
||||||
static const String buildAt = "2023-01-09 13:53:02.523811";
|
static const String buildAt = "2023-01-27 21:38:08.181334";
|
||||||
static const int modifications = 0;
|
static const int modifications = 19;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,4 +18,4 @@ class DynamicColor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final mainColor = DynamicColor(Colors.black87, Colors.white70);
|
final mainColor = DynamicColor(Colors.black87, Colors.white70);
|
||||||
final progressColor = DynamicColor(Colors.grey.shade100, Colors.grey);
|
final progressColor = DynamicColor(Colors.grey.shade100, Colors.white10);
|
||||||
|
|||||||
@@ -3,5 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
const textSize18 = TextStyle(fontSize: 18);
|
const textSize18 = TextStyle(fontSize: 18);
|
||||||
const textSize11 = TextStyle(fontSize: 11);
|
const textSize11 = TextStyle(fontSize: 11);
|
||||||
const textSize13 = TextStyle(fontSize: 13);
|
const textSize13 = TextStyle(fontSize: 13);
|
||||||
|
const textSize13Grey = TextStyle(color: Colors.grey, fontSize: 13);
|
||||||
|
const textSize27 = TextStyle(fontSize: 27);
|
||||||
|
|
||||||
const grey = TextStyle(color: Colors.grey);
|
const grey = TextStyle(color: Colors.grey);
|
||||||
|
|||||||
@@ -4,10 +4,18 @@ import 'package:toolbox/core/persistant_store.dart';
|
|||||||
class SettingStore extends PersistentStore {
|
class SettingStore extends PersistentStore {
|
||||||
StoreProperty<int> get primaryColor =>
|
StoreProperty<int> get primaryColor =>
|
||||||
property('primaryColor', defaultValue: Colors.deepPurpleAccent.value);
|
property('primaryColor', defaultValue: Colors.deepPurpleAccent.value);
|
||||||
|
|
||||||
StoreProperty<int> get serverStatusUpdateInterval =>
|
StoreProperty<int> get serverStatusUpdateInterval =>
|
||||||
property('serverStatusUpdateInterval', defaultValue: 5);
|
property('serverStatusUpdateInterval', defaultValue: 5);
|
||||||
|
|
||||||
|
/// Lanch page idx
|
||||||
StoreProperty<int> get launchPage => property('launchPage', defaultValue: 0);
|
StoreProperty<int> get launchPage => property('launchPage', defaultValue: 0);
|
||||||
|
|
||||||
|
/// Version of store db
|
||||||
StoreProperty<int> get storeVersion =>
|
StoreProperty<int> get storeVersion =>
|
||||||
property('storeVersion', defaultValue: 0);
|
property('storeVersion', defaultValue: 0);
|
||||||
|
|
||||||
|
/// Show logo on server detail page
|
||||||
|
StoreProperty<bool> get showDistLogo =>
|
||||||
|
property('showDistLogo', defaultValue: true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,6 +175,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"noUpdateAvailable":
|
"noUpdateAvailable":
|
||||||
MessageLookupByLibrary.simpleMessage("No update available"),
|
MessageLookupByLibrary.simpleMessage("No update available"),
|
||||||
"ok": MessageLookupByLibrary.simpleMessage("OK"),
|
"ok": MessageLookupByLibrary.simpleMessage("OK"),
|
||||||
|
"onServerDetailPage":
|
||||||
|
MessageLookupByLibrary.simpleMessage("On server detail page"),
|
||||||
"open": MessageLookupByLibrary.simpleMessage("Open"),
|
"open": MessageLookupByLibrary.simpleMessage("Open"),
|
||||||
"path": MessageLookupByLibrary.simpleMessage("Path"),
|
"path": MessageLookupByLibrary.simpleMessage("Path"),
|
||||||
"ping": MessageLookupByLibrary.simpleMessage("Ping"),
|
"ping": MessageLookupByLibrary.simpleMessage("Ping"),
|
||||||
@@ -221,6 +223,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
MessageLookupByLibrary.simpleMessage("No download task."),
|
MessageLookupByLibrary.simpleMessage("No download task."),
|
||||||
"sftpSSHConnected":
|
"sftpSSHConnected":
|
||||||
MessageLookupByLibrary.simpleMessage("SFTP Connected"),
|
MessageLookupByLibrary.simpleMessage("SFTP Connected"),
|
||||||
|
"showDistLogo":
|
||||||
|
MessageLookupByLibrary.simpleMessage("Show distribution logo"),
|
||||||
"snippet": MessageLookupByLibrary.simpleMessage("Snippet"),
|
"snippet": MessageLookupByLibrary.simpleMessage("Snippet"),
|
||||||
"spentTime": m11,
|
"spentTime": m11,
|
||||||
"start": MessageLookupByLibrary.simpleMessage("Start"),
|
"start": MessageLookupByLibrary.simpleMessage("Start"),
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"noServerAvailable": MessageLookupByLibrary.simpleMessage("没有可用的服务器。"),
|
"noServerAvailable": MessageLookupByLibrary.simpleMessage("没有可用的服务器。"),
|
||||||
"noUpdateAvailable": MessageLookupByLibrary.simpleMessage("没有可用更新"),
|
"noUpdateAvailable": MessageLookupByLibrary.simpleMessage("没有可用更新"),
|
||||||
"ok": MessageLookupByLibrary.simpleMessage("好"),
|
"ok": MessageLookupByLibrary.simpleMessage("好"),
|
||||||
|
"onServerDetailPage": MessageLookupByLibrary.simpleMessage("在服务器详情页"),
|
||||||
"open": MessageLookupByLibrary.simpleMessage("打开"),
|
"open": MessageLookupByLibrary.simpleMessage("打开"),
|
||||||
"path": MessageLookupByLibrary.simpleMessage("路径"),
|
"path": MessageLookupByLibrary.simpleMessage("路径"),
|
||||||
"ping": MessageLookupByLibrary.simpleMessage("Ping"),
|
"ping": MessageLookupByLibrary.simpleMessage("Ping"),
|
||||||
@@ -192,6 +193,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"sftpNoDownloadTask": MessageLookupByLibrary.simpleMessage("没有下载任务"),
|
"sftpNoDownloadTask": MessageLookupByLibrary.simpleMessage("没有下载任务"),
|
||||||
"sftpSSHConnected":
|
"sftpSSHConnected":
|
||||||
MessageLookupByLibrary.simpleMessage("SFTP 已连接,即将开始下载..."),
|
MessageLookupByLibrary.simpleMessage("SFTP 已连接,即将开始下载..."),
|
||||||
|
"showDistLogo": MessageLookupByLibrary.simpleMessage("显示发行版 Logo"),
|
||||||
"snippet": MessageLookupByLibrary.simpleMessage("代码片段"),
|
"snippet": MessageLookupByLibrary.simpleMessage("代码片段"),
|
||||||
"spentTime": m11,
|
"spentTime": m11,
|
||||||
"start": MessageLookupByLibrary.simpleMessage("开始"),
|
"start": MessageLookupByLibrary.simpleMessage("开始"),
|
||||||
|
|||||||
@@ -1500,6 +1500,26 @@ class S {
|
|||||||
args: [],
|
args: [],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `Show distribution logo`
|
||||||
|
String get showDistLogo {
|
||||||
|
return Intl.message(
|
||||||
|
'Show distribution logo',
|
||||||
|
name: 'showDistLogo',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `On server detail page`
|
||||||
|
String get onServerDetailPage {
|
||||||
|
return Intl.message(
|
||||||
|
'On server detail page',
|
||||||
|
name: 'onServerDetailPage',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
|
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
|
||||||
|
|||||||
@@ -143,5 +143,7 @@
|
|||||||
"imagesList": "Images list",
|
"imagesList": "Images list",
|
||||||
"dockerImagesFmt": "{count} images",
|
"dockerImagesFmt": "{count} images",
|
||||||
"path": "Path",
|
"path": "Path",
|
||||||
"goto": "Go to"
|
"goto": "Go to",
|
||||||
|
"showDistLogo": "Show distribution logo",
|
||||||
|
"onServerDetailPage": "On server detail page"
|
||||||
}
|
}
|
||||||
@@ -143,5 +143,7 @@
|
|||||||
"imagesList": "镜像列表",
|
"imagesList": "镜像列表",
|
||||||
"dockerImagesFmt": "共 {count} 个镜像",
|
"dockerImagesFmt": "共 {count} 个镜像",
|
||||||
"path": "路径",
|
"path": "路径",
|
||||||
"goto": "前往"
|
"goto": "前往",
|
||||||
|
"showDistLogo": "显示发行版 Logo",
|
||||||
|
"onServerDetailPage": "在服务器详情页"
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,9 @@ import 'package:toolbox/data/provider/server.dart';
|
|||||||
import 'package:toolbox/data/res/color.dart';
|
import 'package:toolbox/data/res/color.dart';
|
||||||
import 'package:toolbox/data/res/font_style.dart';
|
import 'package:toolbox/data/res/font_style.dart';
|
||||||
import 'package:toolbox/data/res/padding.dart';
|
import 'package:toolbox/data/res/padding.dart';
|
||||||
|
import 'package:toolbox/data/store/setting.dart';
|
||||||
import 'package:toolbox/generated/l10n.dart';
|
import 'package:toolbox/generated/l10n.dart';
|
||||||
|
import 'package:toolbox/locator.dart';
|
||||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||||
|
|
||||||
class ServerDetailPage extends StatefulWidget {
|
class ServerDetailPage extends StatefulWidget {
|
||||||
@@ -25,12 +27,16 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
late MediaQueryData _media;
|
late MediaQueryData _media;
|
||||||
late S _s;
|
late S _s;
|
||||||
|
late Color pColor;
|
||||||
|
bool _showDistLogo = true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
_media = MediaQuery.of(context);
|
_media = MediaQuery.of(context);
|
||||||
_s = S.of(context);
|
_s = S.of(context);
|
||||||
|
_showDistLogo = locator<SettingStore>().showDistLogo.fetch()!;
|
||||||
|
pColor = primaryColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -52,24 +58,26 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
body: ListView(
|
body: ListView(
|
||||||
padding: const EdgeInsets.all(13),
|
padding: const EdgeInsets.all(13),
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: _media.size.height * 0.01),
|
...(_buildLinuxIcon(si.status.sysVer) ?? []),
|
||||||
_buildLinuxIcon(si.status.sysVer),
|
|
||||||
SizedBox(height: _media.size.height * 0.03),
|
|
||||||
_buildUpTimeAndSys(si.status),
|
_buildUpTimeAndSys(si.status),
|
||||||
_buildCPUView(si.status),
|
_buildCPUView(si.status),
|
||||||
_buildDiskView(si.status),
|
|
||||||
_buildMemView(si.status),
|
_buildMemView(si.status),
|
||||||
|
_buildDiskView(si.status),
|
||||||
_buildNetView(si.status.netSpeed),
|
_buildNetView(si.status.netSpeed),
|
||||||
|
// avoid the hieght of navigation bar
|
||||||
SizedBox(height: _media.padding.bottom),
|
SizedBox(height: _media.padding.bottom),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildLinuxIcon(String sysVer) {
|
List<Widget>? _buildLinuxIcon(String sysVer) {
|
||||||
|
if (!_showDistLogo) return null;
|
||||||
final iconPath = sysVer.dist?.iconPath;
|
final iconPath = sysVer.dist?.iconPath;
|
||||||
if (iconPath == null) return const SizedBox();
|
if (iconPath == null) return null;
|
||||||
return ConstrainedBox(
|
return [
|
||||||
|
SizedBox(height: _media.size.height * 0.03),
|
||||||
|
ConstrainedBox(
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
maxHeight: _media.size.height * 0.13,
|
maxHeight: _media.size.height * 0.13,
|
||||||
maxWidth: _media.size.width * 0.6,
|
maxWidth: _media.size.width * 0.6,
|
||||||
@@ -78,7 +86,9 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
iconPath,
|
iconPath,
|
||||||
fit: BoxFit.contain,
|
fit: BoxFit.contain,
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
|
SizedBox(height: _media.size.height * 0.03),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCPUView(ServerStatus ss) {
|
Widget _buildCPUView(ServerStatus ss) {
|
||||||
@@ -86,7 +96,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
Padding(
|
Padding(
|
||||||
padding: roundRectCardPadding,
|
padding: roundRectCardPadding,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 12 * ss.cpu2Status.coresCount + 67,
|
height: 12 * ss.cpu2Status.coresCount + 63,
|
||||||
child: Column(children: [
|
child: Column(children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: _media.size.height * 0.02,
|
height: _media.size.height * 0.02,
|
||||||
@@ -96,24 +106,24 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'${ss.cpu2Status.usedPercent(coreIdx: 0).toInt()}%',
|
'${ss.cpu2Status.usedPercent(coreIdx: 0).toInt()}%',
|
||||||
style: const TextStyle(fontSize: 27),
|
style: textSize27,
|
||||||
textScaleFactor: 1.0,
|
textScaleFactor: 1.0,
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
_buildCPUTimePercent(ss.cpu2Status.user, 'user'),
|
_buildDetailPercent(ss.cpu2Status.user, 'user'),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: _media.size.width * 0.03,
|
width: _media.size.width * 0.03,
|
||||||
),
|
),
|
||||||
_buildCPUTimePercent(ss.cpu2Status.sys, 'sys'),
|
_buildDetailPercent(ss.cpu2Status.sys, 'sys'),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: _media.size.width * 0.03,
|
width: _media.size.width * 0.03,
|
||||||
),
|
),
|
||||||
_buildCPUTimePercent(ss.cpu2Status.iowait, 'io'),
|
_buildDetailPercent(ss.cpu2Status.iowait, 'io'),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: _media.size.width * 0.03,
|
width: _media.size.width * 0.03,
|
||||||
),
|
),
|
||||||
_buildCPUTimePercent(ss.cpu2Status.idle, 'idle')
|
_buildDetailPercent(ss.cpu2Status.idle, 'idle')
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@@ -125,7 +135,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCPUTimePercent(double percent, String timeType) {
|
Widget _buildDetailPercent(double percent, String timeType) {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@@ -150,7 +160,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
height: 12.0 * ss.cpu2Status.coresCount,
|
height: 12.0 * ss.cpu2Status.coresCount,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 17),
|
padding: const EdgeInsets.only(top: 13),
|
||||||
itemBuilder: (ctx, idx) {
|
itemBuilder: (ctx, idx) {
|
||||||
if (idx == 0) return const SizedBox();
|
if (idx == 0) return const SizedBox();
|
||||||
return Padding(
|
return Padding(
|
||||||
@@ -165,7 +175,6 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
|
|
||||||
Widget _buildProgress(double percent) {
|
Widget _buildProgress(double percent) {
|
||||||
if (percent > 100) percent = 100;
|
if (percent > 100) percent = 100;
|
||||||
final pColor = primaryColor;
|
|
||||||
final percentWithinOne = percent / 100;
|
final percentWithinOne = percent / 100;
|
||||||
return LinearProgressIndicator(
|
return LinearProgressIndicator(
|
||||||
value: percentWithinOne,
|
value: percentWithinOne,
|
||||||
@@ -193,14 +202,14 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMemView(ServerStatus ss) {
|
Widget _buildMemView(ServerStatus ss) {
|
||||||
final pColor = primaryColor;
|
final used = ss.memory.used / ss.memory.total * 100;
|
||||||
final used = ss.memory.used / ss.memory.total;
|
final free = ss.memory.free / ss.memory.total * 100;
|
||||||
final width = _media.size.width - 17 * 2 - 17 * 2;
|
final avail = ss.memory.avail / ss.memory.total * 100;
|
||||||
const mb = 1024;
|
|
||||||
return RoundRectCard(Padding(
|
return RoundRectCard(Padding(
|
||||||
padding: roundRectCardPadding,
|
padding: roundRectCardPadding,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 47,
|
height: 70,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@@ -208,64 +217,35 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
_buildMemExplain((ss.memory.used * mb).convertBytes, pColor),
|
Row(
|
||||||
_buildMemExplain(
|
children: [
|
||||||
(ss.memory.cache * mb).convertBytes, pColor.withAlpha(77)),
|
Text('${used.toStringAsFixed(0)}%', style: textSize27),
|
||||||
_buildMemExplain(
|
const SizedBox(width: 7),
|
||||||
((ss.memory.total - ss.memory.used) * mb).convertBytes,
|
Text('of ${(ss.memory.total * 1024).convertBytes}',
|
||||||
progressColor.resolve(context),
|
style: textSize13Grey)
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(
|
|
||||||
height: 7,
|
|
||||||
),
|
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
_buildDetailPercent(free, 'free'),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: width * used,
|
width: _media.size.width * 0.03,
|
||||||
child: LinearProgressIndicator(
|
|
||||||
value: 1,
|
|
||||||
color: pColor,
|
|
||||||
)),
|
|
||||||
SizedBox(
|
|
||||||
width: width * (1 - used),
|
|
||||||
child: LinearProgressIndicator(
|
|
||||||
// memory.total == 1: failed to get mem, now mem = [emptyMemory] which is initial value.
|
|
||||||
value: ss.memory.total == 1
|
|
||||||
? 0
|
|
||||||
: ss.memory.cache / (ss.memory.total - ss.memory.used),
|
|
||||||
backgroundColor: progressColor.resolve(context),
|
|
||||||
color: pColor.withAlpha(77),
|
|
||||||
),
|
),
|
||||||
)
|
_buildDetailPercent(avail, 'avail'),
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 11,
|
||||||
|
),
|
||||||
|
_buildProgress(used)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMemExplain(String value, Color color) {
|
|
||||||
return Row(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
color: color,
|
|
||||||
height: 11,
|
|
||||||
width: 11,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
Text(
|
|
||||||
value,
|
|
||||||
style: textSize11,
|
|
||||||
textScaleFactor: 1.0,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildDiskView(ServerStatus ss) {
|
Widget _buildDiskView(ServerStatus ss) {
|
||||||
final clone = ss.disk.toList();
|
final clone = ss.disk.toList();
|
||||||
for (var item in ss.disk) {
|
for (var item in ss.disk) {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class SettingPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SettingPageState extends State<SettingPage> {
|
class _SettingPageState extends State<SettingPage> {
|
||||||
late SettingStore _store;
|
late SettingStore _setting;
|
||||||
late int _selectedColorValue;
|
late int _selectedColorValue;
|
||||||
late int _launchPageIdx;
|
late int _launchPageIdx;
|
||||||
late Color priColor;
|
late Color priColor;
|
||||||
@@ -47,9 +47,9 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_serverProvider = locator<ServerProvider>();
|
_serverProvider = locator<ServerProvider>();
|
||||||
_store = locator<SettingStore>();
|
_setting = locator<SettingStore>();
|
||||||
_launchPageIdx = _store.launchPage.fetch()!;
|
_launchPageIdx = _setting.launchPage.fetch()!;
|
||||||
_intervalValue = _store.serverStatusUpdateInterval.fetch()!.toDouble();
|
_intervalValue = _setting.serverStatusUpdateInterval.fetch()!.toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -64,12 +64,27 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
_buildAppColorPreview(),
|
_buildAppColorPreview(),
|
||||||
_buildUpdateInterval(),
|
_buildUpdateInterval(),
|
||||||
_buildCheckUpdate(),
|
_buildCheckUpdate(),
|
||||||
_buildLaunchPage()
|
_buildLaunchPage(),
|
||||||
|
_buildDistLogoSwitch(),
|
||||||
].map((e) => RoundRectCard(e)).toList(),
|
].map((e) => RoundRectCard(e)).toList(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildDistLogoSwitch() {
|
||||||
|
return ListTile(
|
||||||
|
title: Text(
|
||||||
|
_s.showDistLogo,
|
||||||
|
style: textSize13,
|
||||||
|
),
|
||||||
|
subtitle: Text(
|
||||||
|
_s.onServerDetailPage,
|
||||||
|
style: textSize13Grey,
|
||||||
|
),
|
||||||
|
trailing: buildSwitch(context, _setting.showDistLogo),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildCheckUpdate() {
|
Widget _buildCheckUpdate() {
|
||||||
return Consumer<AppProvider>(
|
return Consumer<AppProvider>(
|
||||||
builder: (_, app, __) {
|
builder: (_, app, __) {
|
||||||
@@ -109,7 +124,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
),
|
),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
_s.willTakEeffectImmediately,
|
_s.willTakEeffectImmediately,
|
||||||
style: const TextStyle(color: Colors.grey, fontSize: 13),
|
style: textSize13Grey,
|
||||||
),
|
),
|
||||||
trailing: Text('${_intervalValue.toInt()} ${_s.second}'),
|
trailing: Text('${_intervalValue.toInt()} ${_s.second}'),
|
||||||
children: [
|
children: [
|
||||||
@@ -125,7 +140,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
onChangeEnd: (val) {
|
onChangeEnd: (val) {
|
||||||
_store.serverStatusUpdateInterval.put(val.toInt());
|
_setting.serverStatusUpdateInterval.put(val.toInt());
|
||||||
_serverProvider.startAutoRefresh();
|
_serverProvider.startAutoRefresh();
|
||||||
},
|
},
|
||||||
label: '${_intervalValue.toInt()} ${_s.second}',
|
label: '${_intervalValue.toInt()} ${_s.second}',
|
||||||
@@ -181,7 +196,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
return IconButton(
|
return IconButton(
|
||||||
icon: const Icon(Icons.save),
|
icon: const Icon(Icons.save),
|
||||||
onPressed: (() {
|
onPressed: (() {
|
||||||
_store.primaryColor.put(_selectedColorValue);
|
_setting.primaryColor.put(_selectedColorValue);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@@ -228,7 +243,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
onChanged: (int? value) {
|
onChanged: (int? value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_launchPageIdx = value!;
|
_launchPageIdx = value!;
|
||||||
_store.launchPage.put(value);
|
_setting.launchPage.put(value);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user