download and downloading page

This commit is contained in:
wgh19
2024-05-14 13:49:54 +08:00
parent 615720ab49
commit 842a52f53d
13 changed files with 661 additions and 68 deletions

View File

@@ -19,4 +19,16 @@ extension FSExt on FileSystemEntity {
}
return 0;
}
}
String bytesToText(int bytes) {
if(bytes < 1024) {
return "$bytes B";
} else if(bytes < 1024 * 1024) {
return "${(bytes / 1024).toStringAsFixed(2)} KB";
} else if(bytes < 1024 * 1024 * 1024) {
return "${(bytes / 1024 / 1024).toStringAsFixed(2)} MB";
} else {
return "${(bytes / 1024 / 1024 / 1024).toStringAsFixed(2)} GB";
}
}