feat: display cpu model (#477)

This commit is contained in:
lollipopkit🏳️‍⚧️
2024-07-23 12:03:10 +08:00
committed by GitHub
parent 41ec46f1d3
commit 87b3b76b0b
4 changed files with 58 additions and 17 deletions

View File

@@ -198,6 +198,29 @@ class _ServerDetailPageState extends State<ServerDetailPage>
]);
}
final List<Widget> children = Stores.setting.cpuViewAsProgress.fetch()
? _buildCPUProgress(ss.cpu)
: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 17, vertical: 13),
child: SizedBox(
height: 137,
width: _media.size.width - 26 - 34,
child: _buildLineChart(
ss.cpu.spots,
//ss.cpu.rangeX,
tooltipPrefix: 'CPU',
),
),
),
];
if (ss.cpu.brand.isNotEmpty) {
children.add(Column(
children: ss.cpu.brand.entries.map(_buildCpuModelItem).toList(),
).paddingOnly(top: 13));
}
return CardX(
child: ExpandTile(
title: Align(
@@ -214,27 +237,21 @@ class _ServerDetailPageState extends State<ServerDetailPage>
mainAxisSize: MainAxisSize.min,
children: details,
),
children: Stores.setting.cpuViewAsProgress.fetch()
? _buildCPUProgress(ss.cpu)
: [
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 17, vertical: 13),
child: SizedBox(
height: 137,
width: _media.size.width - 26 - 34,
child: _buildLineChart(
ss.cpu.spots,
//ss.cpu.rangeX,
tooltipPrefix: 'CPU',
),
),
),
],
children: children,
),
);
}
Widget _buildCpuModelItem(MapEntry<String, int> e) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(e.key, style: UIs.text13),
Text('x ${e.value}', style: UIs.text13Grey),
],
).paddingSymmetric(horizontal: 17);
}
Widget _buildDetailPercent(double percent, String timeType) {
return Column(
mainAxisSize: MainAxisSize.min,