opt.: disk size (#252)

This commit is contained in:
lollipopkit
2024-01-21 18:01:11 +08:00
parent 362dcdf288
commit 50d6ed919b
11 changed files with 42 additions and 32 deletions

View File

@@ -193,8 +193,8 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage> {
context.showSnackBar(
l10n.fileTooLarge(
path,
size.convertBytes,
Miscs.privateKeyMaxSize.convertBytes,
size.bytes2Str,
Miscs.privateKeyMaxSize.bytes2Str,
),
);
return;

View File

@@ -256,7 +256,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
),
UIs.width7,
Text(
'of ${(ss.mem.total * 1024).convertBytes}',
'of ${(ss.mem.total * 1024).bytes2Str}',
style: UIs.text13Grey,
)
],
@@ -297,7 +297,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
Text('${used.toStringAsFixed(0)}%', style: UIs.text27),
UIs.width7,
Text(
'of ${(ss.swap.total * 1024).convertBytes} ',
'of ${(ss.swap.total * 1024).bytes2Str} ',
style: UIs.text13Grey,
)
],
@@ -452,7 +452,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
Widget _buildDiskItem(Disk disk, ServerStatus ss) {
final (read, write) = ss.diskIO.getSpeed(disk.dev);
final text = () {
final use = '${disk.used} / ${disk.size}';
final use = '${disk.used.kb2Str} / ${disk.size.kb2Str}';
if (read == null || write == null) return use;
return '$use\n${l10n.read} $read | ${l10n.write} $write';
}();

View File

@@ -182,7 +182,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
title: Text(fileName),
subtitle: isDir
? null
: Text(stat.size.convertBytes, style: UIs.textGrey),
: Text(stat.size.bytes2Str, style: UIs.textGrey),
trailing: Text(
stat.modified
.toString()

View File

@@ -304,7 +304,7 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
subtitle: isDir
? null
: Text(
(file.attr.size ?? 0).convertBytes,
(file.attr.size ?? 0).bytes2Str,
style: UIs.textGrey,
),
onTap: () {

View File

@@ -94,7 +94,7 @@ class _SftpMissionPageState extends State<SftpMissionPage> {
);
case SftpWorkerStatus.loading:
final percentStr = (status.progress ?? 0.0).toStringAsFixed(2);
final size = (status.size ?? 0).convertBytes;
final size = (status.size ?? 0).bytes2Str;
return _wrapInCard(
status: status,
subtitle: l10n.percentOfSize(percentStr, size),