mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-18 07:44:26 +01:00
Fix mem progress display percent.
This commit is contained in:
@@ -2,9 +2,8 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ToolBox";
|
||||
static const int build = 68;
|
||||
static const String engine =
|
||||
"Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 77d935af4d (2 weeks ago) • 2021-12-16 08:37:33 -0800\nEngine • revision 890a5fca2e\nTools • Dart 2.15.1\n";
|
||||
static const String buildAt = "2022-01-02 14:53:09.769990";
|
||||
static const int modifications = 3;
|
||||
static const int build = 69;
|
||||
static const String engine = "Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 77d935af4d (2 weeks ago) • 2021-12-16 08:37:33 -0800\nEngine • revision 890a5fca2e\nTools • Dart 2.15.1\n";
|
||||
static const String buildAt = "2022-01-02 19:20:43.964228";
|
||||
static const int modifications = 2;
|
||||
}
|
||||
|
||||
@@ -191,7 +191,11 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
for (; value / 1024 > 1 && squareTimes < 3; squareTimes++) {
|
||||
value /= 1024;
|
||||
}
|
||||
return '${value.toStringAsFixed(1)} ${suffix[squareTimes]}';
|
||||
var finalValue = value.toStringAsFixed(1);
|
||||
if (finalValue.endsWith('.0')) {
|
||||
finalValue = finalValue.replaceFirst('.0', '');
|
||||
}
|
||||
return '$finalValue ${suffix[squareTimes]}';
|
||||
}
|
||||
|
||||
Widget _buildMemView(ServerStatus ss) {
|
||||
@@ -231,7 +235,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
// 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.cache / (ss.memory.total - ss.memory.used),
|
||||
backgroundColor: progressColor.resolve(context),
|
||||
color: pColor.withAlpha(77),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user