mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
Optimize layout
This commit is contained in:
@@ -354,7 +354,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 79;
|
CURRENT_PROJECT_VERSION = 83;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -362,7 +362,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.79;
|
MARKETING_VERSION = 1.0.83;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
@@ -484,7 +484,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 79;
|
CURRENT_PROJECT_VERSION = 83;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -492,7 +492,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.79;
|
MARKETING_VERSION = 1.0.83;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
@@ -508,7 +508,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 79;
|
CURRENT_PROJECT_VERSION = 83;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -516,7 +516,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.79;
|
MARKETING_VERSION = 1.0.83;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
|
|||||||
@@ -26,11 +26,7 @@ import 'package:toolbox/locator.dart';
|
|||||||
/// Because of this function is called by [compute] in [ServerProvider.genClient].
|
/// Because of this function is called by [compute] in [ServerProvider.genClient].
|
||||||
/// https://stackoverflow.com/questions/51998995/invalid-arguments-illegal-argument-in-isolate-message-object-is-a-closure
|
/// https://stackoverflow.com/questions/51998995/invalid-arguments-illegal-argument-in-isolate-message-object-is-a-closure
|
||||||
List<SSHKeyPair> loadIndentity(String key) {
|
List<SSHKeyPair> loadIndentity(String key) {
|
||||||
final watch = Stopwatch()..start();
|
return SSHKeyPair.fromPem(key);
|
||||||
final pem = SSHKeyPair.fromPem(key);
|
|
||||||
watch.stop();
|
|
||||||
print('loadIndentity: ${watch.elapsedMilliseconds}ms');
|
|
||||||
return pem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ServerProvider extends BusyProvider {
|
class ServerProvider extends BusyProvider {
|
||||||
@@ -150,11 +146,9 @@ class ServerProvider extends BusyProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _getData(int idx) async {
|
Future<void> _getData(int idx) async {
|
||||||
final client = _servers[idx].client;
|
|
||||||
final info = _servers[idx].info;
|
final info = _servers[idx].info;
|
||||||
final connected = client != null;
|
|
||||||
final state = _servers[idx].connectionState;
|
final state = _servers[idx].connectionState;
|
||||||
if (!connected ||
|
if (_servers[idx].client == null ||
|
||||||
state == ServerConnectionState.failed ||
|
state == ServerConnectionState.failed ||
|
||||||
state == ServerConnectionState.disconnected) {
|
state == ServerConnectionState.disconnected) {
|
||||||
_servers[idx].connectionState = ServerConnectionState.connecting;
|
_servers[idx].connectionState = ServerConnectionState.connecting;
|
||||||
@@ -169,7 +163,7 @@ class ServerProvider extends BusyProvider {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
_servers[idx].connectionState = ServerConnectionState.failed;
|
_servers[idx].connectionState = ServerConnectionState.failed;
|
||||||
_servers[idx].status.failedInfo = e.toString();
|
_servers[idx].status.failedInfo = e.toString() + ' ## ';
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
logger.warning(e);
|
logger.warning(e);
|
||||||
}
|
}
|
||||||
@@ -230,7 +224,7 @@ class ServerProvider extends BusyProvider {
|
|||||||
} else {
|
} else {
|
||||||
info.status.sysVer = '';
|
info.status.sysVer = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,9 +263,8 @@ class ServerProvider extends BusyProvider {
|
|||||||
if (cpus.isEmpty) {
|
if (cpus.isEmpty) {
|
||||||
info.status.cpu2Status = emptyCpu2Status;
|
info.status.cpu2Status = emptyCpu2Status;
|
||||||
} else {
|
} else {
|
||||||
|
info.status.cpu2Status =
|
||||||
info.status.cpu2Status =
|
info.status.cpu2Status.update(cpus, _getCPUTemp(temp));
|
||||||
info.status.cpu2Status.update(cpus, _getCPUTemp(temp));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
// This file is generated by ./make.dart
|
// This file is generated by ./make.dart
|
||||||
|
|
||||||
class BuildData {
|
class BuildData {
|
||||||
static const String name = "ToolBox";
|
static const String name = "ServerBox";
|
||||||
static const int build = 82;
|
static const int build = 83;
|
||||||
static const String engine = "Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 77d935af4d (4 weeks ago) • 2021-12-16 08:37:33 -0800\nEngine • revision 890a5fca2e\nTools • Dart 2.15.1\n";
|
static const String engine =
|
||||||
static const String buildAt = "2022-01-11 13:31:16.586591";
|
"Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 77d935af4d (4 weeks ago) • 2021-12-16 08:37:33 -0800\nEngine • revision 890a5fca2e\nTools • Dart 2.15.1\n";
|
||||||
static const int modifications = 3;
|
static const String buildAt = "2022-01-16 15:14:10.759902";
|
||||||
|
static const int modifications = 6;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,12 +103,9 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
'Edit server info page')
|
'Edit server info page')
|
||||||
.go(context),
|
.go(context),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(13),
|
padding: const EdgeInsets.all(13),
|
||||||
child: SizedBox(
|
child: _buildRealServerCard(
|
||||||
height: _media.size.height * 0.147,
|
si.status, si.info.name, si.connectionState)),
|
||||||
child: _buildRealServerCard(
|
|
||||||
si.status, si.info.name, si.connectionState)),
|
|
||||||
),
|
|
||||||
onTap: () => AppRoute(ServerDetailPage('${si.info.ip}:${si.info.port}'),
|
onTap: () => AppRoute(ServerDetailPage('${si.info.ip}:${si.info.port}'),
|
||||||
'server detail page')
|
'server detail page')
|
||||||
.go(context),
|
.go(context),
|
||||||
@@ -142,7 +139,7 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
hasError
|
hasError
|
||||||
? ConstrainedBox(
|
? ConstrainedBox(
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
maxWidth: _media.size.width * 0.57, maxHeight: 17),
|
maxWidth: _media.size.width * 0.57, maxHeight: 15),
|
||||||
child: Marquee(
|
child: Marquee(
|
||||||
accelerationDuration: const Duration(seconds: 3),
|
accelerationDuration: const Duration(seconds: 3),
|
||||||
accelerationCurve: Curves.linear,
|
accelerationCurve: Curves.linear,
|
||||||
@@ -159,20 +156,42 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
height: 17,
|
height: 17,
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
_buildPercentCircle(ss.cpu2Status.usedPercent(), 'CPU'),
|
_buildPercentCircle(ss.cpu2Status.usedPercent()),
|
||||||
_buildPercentCircle(ss.memory.used / ss.memory.total * 100, 'Mem'),
|
_buildPercentCircle(ss.memory.used / ss.memory.total * 100),
|
||||||
_buildIOData('Net', 'Conn:\n' + ss.tcp.maxConn.toString(),
|
_buildIOData('Conn:\n' + ss.tcp.maxConn.toString(),
|
||||||
'Fail:\n' + ss.tcp.fail.toString()),
|
'Fail:\n' + ss.tcp.fail.toString()),
|
||||||
_buildIOData('Disk', 'Total:\n' + rootDisk.size,
|
_buildIOData('Total:\n' + rootDisk.size,
|
||||||
'Used:\n' + rootDisk.usedPercent.toString() + '%')
|
'Used:\n' + rootDisk.usedPercent.toString() + '%')
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 13),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
_buildExplainText('CPU'),
|
||||||
|
_buildExplainText('Mem'),
|
||||||
|
_buildExplainText('Net'),
|
||||||
|
_buildExplainText('Disk'),
|
||||||
|
],
|
||||||
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildExplainText(String text) {
|
||||||
|
return SizedBox(
|
||||||
|
width: _media.size.width * 0.2,
|
||||||
|
child: Text(
|
||||||
|
text,
|
||||||
|
style: const TextStyle(fontSize: 12),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
textScaleFactor: 1.0,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
String getTopRightStr(ServerConnectionState cs, String temp, String upTime,
|
String getTopRightStr(ServerConnectionState cs, String temp, String upTime,
|
||||||
String? failedInfo) {
|
String? failedInfo) {
|
||||||
switch (cs) {
|
switch (cs) {
|
||||||
@@ -195,36 +214,24 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildIOData(String title, String up, String down) {
|
Widget _buildIOData(String up, String down) {
|
||||||
final statusTextStyle = TextStyle(
|
final statusTextStyle = TextStyle(
|
||||||
fontSize: 9, color: _theme.textTheme.bodyText1!.color!.withAlpha(177));
|
fontSize: 9, color: _theme.textTheme.bodyText1!.color!.withAlpha(177));
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: _media.size.width * 0.2,
|
width: _media.size.width * 0.2,
|
||||||
height: _media.size.height * 0.1,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(),
|
const SizedBox(height: 5),
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
up,
|
|
||||||
style: statusTextStyle,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
textScaleFactor: 1.0,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 3),
|
|
||||||
Text(
|
|
||||||
down + '\n',
|
|
||||||
style: statusTextStyle,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
textScaleFactor: 1.0,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Text(
|
Text(
|
||||||
title,
|
up,
|
||||||
style: const TextStyle(fontSize: 12),
|
style: statusTextStyle,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
textScaleFactor: 1.0,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 3),
|
||||||
|
Text(
|
||||||
|
down,
|
||||||
|
style: statusTextStyle,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
textScaleFactor: 1.0,
|
textScaleFactor: 1.0,
|
||||||
)
|
)
|
||||||
@@ -233,42 +240,31 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildPercentCircle(double percent, String title) {
|
Widget _buildPercentCircle(double percent) {
|
||||||
if (percent <= 0) percent = 0.01;
|
if (percent <= 0) percent = 0.01;
|
||||||
if (percent >= 100) percent = 99.9;
|
if (percent >= 100) percent = 99.9;
|
||||||
var size = _media.size.height * 0.15;
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: _media.size.width * 0.2,
|
width: _media.size.width * 0.2,
|
||||||
height: _media.size.height * 0.1,
|
child: Stack(
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
children: [
|
||||||
Stack(
|
Center(
|
||||||
children: [
|
child: CircleChart(
|
||||||
CircleChart(
|
progressColor: _primaryColor,
|
||||||
progressColor: _primaryColor,
|
progressNumber: percent,
|
||||||
progressNumber: percent,
|
maxNumber: 100,
|
||||||
maxNumber: 100,
|
width: 53,
|
||||||
width: size,
|
height: 53,
|
||||||
height: size / 1.5,
|
),
|
||||||
),
|
|
||||||
Positioned.fill(
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
'${percent.toStringAsFixed(1)}%',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: const TextStyle(fontSize: 11),
|
|
||||||
textScaleFactor: 1.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
Text(
|
Positioned.fill(
|
||||||
title,
|
child: Center(
|
||||||
style: const TextStyle(fontSize: 12),
|
child: Text(
|
||||||
textAlign: TextAlign.center,
|
'${percent.toStringAsFixed(1)}%',
|
||||||
textScaleFactor: 1.0,
|
textAlign: TextAlign.center,
|
||||||
|
style: const TextStyle(fontSize: 11),
|
||||||
|
textScaleFactor: 1.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
10
pubspec.lock
10
pubspec.lock
@@ -60,11 +60,9 @@ packages:
|
|||||||
circle_chart:
|
circle_chart:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "../circle_chart"
|
||||||
ref: main
|
relative: true
|
||||||
resolved-ref: "36a46aaa41690aac96fa808a6e75841464007a3b"
|
source: path
|
||||||
url: "https://github.com/LollipopKit/circle_chart"
|
|
||||||
source: git
|
|
||||||
version: "0.0.3"
|
version: "0.0.3"
|
||||||
clipboard:
|
clipboard:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
@@ -123,7 +121,7 @@ packages:
|
|||||||
name: dartssh2
|
name: dartssh2
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.3.0-pre"
|
version: "2.3.1-pre"
|
||||||
dio:
|
dio:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -42,13 +42,14 @@ dependencies:
|
|||||||
git:
|
git:
|
||||||
url: https://github.com/Countly/countly-sdk-flutter-bridge.git
|
url: https://github.com/Countly/countly-sdk-flutter-bridge.git
|
||||||
ref: master
|
ref: master
|
||||||
dartssh2: ^2.3.0-pre
|
dartssh2: ^2.3.1-pre
|
||||||
logging: ^1.0.2
|
logging: ^1.0.2
|
||||||
flutter_material_color_picker: ^1.1.0+2
|
flutter_material_color_picker: ^1.1.0+2
|
||||||
circle_chart:
|
circle_chart:
|
||||||
git:
|
# git:
|
||||||
url: https://github.com/LollipopKit/circle_chart
|
# url: https://github.com/LollipopKit/circle_chart
|
||||||
ref: main
|
# ref: main
|
||||||
|
path: ../circle_chart
|
||||||
clipboard: ^0.1.3
|
clipboard: ^0.1.3
|
||||||
r_upgrade: ^0.3.6
|
r_upgrade: ^0.3.6
|
||||||
pull_to_refresh: ^2.0.0
|
pull_to_refresh: ^2.0.0
|
||||||
|
|||||||
Reference in New Issue
Block a user