opt.: detail page cpu collapse / expand

This commit is contained in:
lollipopkit
2023-11-01 00:01:09 -06:00
parent 040cd6a29f
commit 3d47390bf1
5 changed files with 76 additions and 58 deletions

View File

@@ -586,7 +586,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 618;
CURRENT_PROJECT_VERSION = 622;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -596,7 +596,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.618;
MARKETING_VERSION = 1.0.622;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -720,7 +720,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 618;
CURRENT_PROJECT_VERSION = 622;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -730,7 +730,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.618;
MARKETING_VERSION = 1.0.622;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -748,7 +748,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 618;
CURRENT_PROJECT_VERSION = 622;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -758,7 +758,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.618;
MARKETING_VERSION = 1.0.622;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -779,7 +779,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 618;
CURRENT_PROJECT_VERSION = 622;
DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
@@ -792,7 +792,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.618;
MARKETING_VERSION = 1.0.622;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
@@ -818,7 +818,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 618;
CURRENT_PROJECT_VERSION = 622;
DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
@@ -831,7 +831,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.618;
MARKETING_VERSION = 1.0.622;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -854,7 +854,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 618;
CURRENT_PROJECT_VERSION = 622;
DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
@@ -867,7 +867,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.618;
MARKETING_VERSION = 1.0.622;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -890,7 +890,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 618;
CURRENT_PROJECT_VERSION = 622;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES;
@@ -902,7 +902,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.618;
MARKETING_VERSION = 1.0.622;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
@@ -931,7 +931,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 618;
CURRENT_PROJECT_VERSION = 622;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES;
@@ -943,7 +943,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.618;
MARKETING_VERSION = 1.0.622;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
PRODUCT_NAME = ServerBox;
@@ -969,7 +969,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 618;
CURRENT_PROJECT_VERSION = 622;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES;
@@ -981,7 +981,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.618;
MARKETING_VERSION = 1.0.622;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
PRODUCT_NAME = ServerBox;

View File

@@ -2,9 +2,9 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 618;
static const int build = 622;
static const String engine = "3.13.8";
static const String buildAt = "2023-10-31 15:59:28";
static const int modifications = 7;
static const int script = 23;
static const String buildAt = "2023-10-31 20:16:41";
static const int modifications = 2;
static const int script = 25;
}

View File

@@ -7,10 +7,16 @@ class UIs {
static const textSize9Grey = TextStyle(color: Colors.grey, fontSize: 9);
static const textSize11 = TextStyle(fontSize: 11);
static const textSize11Bold = TextStyle(
fontSize: 11,
fontWeight: FontWeight.w500,
);
static const textSize11Grey = TextStyle(color: Colors.grey, fontSize: 11);
static const textSize13 = TextStyle(fontSize: 13);
static const textSize13Bold =
TextStyle(fontSize: 13, fontWeight: FontWeight.bold);
static const textSize13Bold = TextStyle(
fontSize: 13,
fontWeight: FontWeight.bold,
);
static const textSize13Grey = TextStyle(color: Colors.grey, fontSize: 13);
static const textSize15 = TextStyle(fontSize: 15);
static const textSize18 = TextStyle(fontSize: 18);

View File

@@ -134,10 +134,8 @@ class _ServerDetailPageState extends State<ServerDetailPage>
}
return CardX(
Padding(
padding: UIs.roundRectCardPadding,
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
Row(
ExpandTile(
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildAnimatedText(
@@ -146,13 +144,14 @@ class _ServerDetailPageState extends State<ServerDetailPage>
UIs.textSize27,
),
Row(
mainAxisSize: MainAxisSize.min,
children: details,
)
),
],
),
UIs.height13,
_buildCPUProgress(ss.cpu)
]),
childrenPadding: const EdgeInsets.symmetric(vertical: 13),
initiallyExpanded: ss.cpu.coresCount <= 8,
children: _buildCPUProgress(ss.cpu),
),
);
}
@@ -177,18 +176,18 @@ class _ServerDetailPageState extends State<ServerDetailPage>
);
}
Widget _buildCPUProgress(Cpus cs) {
List<Widget> _buildCPUProgress(Cpus cs) {
final children = <Widget>[];
for (var i = 0; i < cs.coresCount; i++) {
if (i == 0) continue;
children.add(
Padding(
padding: const EdgeInsets.all(2),
padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 17),
child: _buildProgress(cs.usedPercent(coreIdx: i)),
),
);
}
return Column(children: children);
return children;
}
Widget _buildProgress(double percent) {
@@ -320,6 +319,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
return CardX(
ExpandTile(
title: Text(l10n.disk),
childrenPadding: EdgeInsets.zero,
leading: const Icon(Icons.storage, size: 17),
initiallyExpanded: children.length <= 7,
children: children,
@@ -330,30 +330,36 @@ class _ServerDetailPageState extends State<ServerDetailPage>
Widget _buildDiskItem(Disk disk, ServerStatus ss) {
final (read, write) = ss.diskIO.getReadSpeed(disk.dev);
final text = () {
final use = '${disk.usedPercent}% of ${disk.size}';
final use = '${disk.used} / ${disk.size}';
if (read == null || write == null) return use;
return '$use\n $read | $write';
return '$use\nR $read | W $write';
}();
return ListTile(
title: Text(
disk.dev,
style: UIs.textSize13Bold,
style: UIs.textSize11Bold,
textScaleFactor: _textFactor,
),
contentPadding: const EdgeInsets.symmetric(vertical: 3, horizontal: 17),
contentPadding: const EdgeInsets.symmetric(horizontal: 17),
subtitle: Text(
text,
style: UIs.textSize11,
style: UIs.textSize11Grey,
textScaleFactor: _textFactor,
),
trailing: SizedBox(
height: 37,
width: 37,
child: CircularProgressIndicator(
child: Stack(
alignment: Alignment.center,
children: [
CircularProgressIndicator(
value: disk.usedPercent / 100,
strokeWidth: 7,
strokeWidth: 5,
backgroundColor: DynamicColors.progress.resolve(context),
valueColor: AlwaysStoppedAnimation(primaryColor),
color: primaryColor,
),
Text('${disk.usedPercent}%', style: UIs.textSize9Grey)
],
),
),
);
@@ -413,14 +419,14 @@ class _ServerDetailPageState extends State<ServerDetailPage>
return ListTile(
title: Text(
device,
style: UIs.textSize13Bold,
style: UIs.textSize11Bold,
textScaleFactor: _textFactor,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
subtitle: Text(
'${ns.sizeIn(device: device)} | ${ns.sizeOut(device: device)}',
style: UIs.textSize11,
style: UIs.textSize11Grey,
textScaleFactor: _textFactor,
),
trailing: SizedBox(
@@ -428,6 +434,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
child: Text(
'${ns.speedOut(device: device)}\n${ns.speedIn(device: device)}',
textAlign: TextAlign.end,
style: UIs.textSize11Grey,
),
),
);
@@ -464,6 +471,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
text,
style: style,
textScaleFactor: _textFactor,
textAlign: TextAlign.left,
),
transitionBuilder: (child, animation) => FadeTransition(
opacity: animation,

View File

@@ -10,5 +10,9 @@ class ExpandTile extends ExpansionTile {
super.children,
super.subtitle,
super.initiallyExpanded,
super.tilePadding,
super.childrenPadding,
super.trailing,
super.controller,
}) : super(shape: _shape, collapsedShape: _shape);
}