mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-18 15:54:35 +01:00
new: swap view for #10
This commit is contained in:
@@ -62,6 +62,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
_buildUpTimeAndSys(si.status),
|
||||
_buildCPUView(si.status),
|
||||
_buildMemView(si.status),
|
||||
_buildSwapView(si.status),
|
||||
_buildDiskView(si.status),
|
||||
_buildNetView(si.status.netSpeed),
|
||||
// avoid the hieght of navigation bar
|
||||
@@ -219,7 +220,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
children: [
|
||||
Text('${used.toStringAsFixed(0)}%', style: textSize27),
|
||||
width7,
|
||||
Text('of ${(ss.mem.total * 1024).convertBytes}',
|
||||
Text('of ${(ss.mem.total * 1024).convertBytes} Mem',
|
||||
style: textSize13Grey)
|
||||
],
|
||||
),
|
||||
@@ -242,6 +243,48 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSwapView(ServerStatus ss) {
|
||||
if (ss.swap.total == 0) return const SizedBox();
|
||||
final used = ss.swap.used / ss.swap.total * 100;
|
||||
final free = ss.swap.free / ss.swap.total * 100;
|
||||
final cached = ss.swap.cached / ss.swap.total * 100;
|
||||
return RoundRectCard(
|
||||
Padding(
|
||||
padding: roundRectCardPadding,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text('${used.toStringAsFixed(0)}%', style: textSize27),
|
||||
width7,
|
||||
Text('of ${(ss.swap.total * 1024).convertBytes} Swap',
|
||||
style: textSize13Grey)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
_buildDetailPercent(free, 'free'),
|
||||
width13,
|
||||
_buildDetailPercent(cached, 'cached')
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 11,
|
||||
),
|
||||
_buildProgress(used)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDiskView(ServerStatus ss) {
|
||||
final clone = ss.disk.toList();
|
||||
for (var item in ss.disk) {
|
||||
|
||||
Reference in New Issue
Block a user