forked from Nexus/nexus
Remove flutter chat (#26)
Had to squash merge manually as Forgejo was erroring
This commit is contained in:
parent
bd1d5ea745
commit
16cf126df4
111 changed files with 3162 additions and 2366 deletions
22
lib/helpers/extensions/size_to_string.dart
Normal file
22
lib/helpers/extensions/size_to_string.dart
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||
|
||||
extension SizeToString on int {
|
||||
String get sizeAsString {
|
||||
const IListConst<String> suffixes = IListConst([
|
||||
"B",
|
||||
"KB",
|
||||
"MB",
|
||||
"GB",
|
||||
"TB",
|
||||
"PB",
|
||||
]);
|
||||
|
||||
var i = 0;
|
||||
var size = toDouble();
|
||||
while (size > 1024 && i < suffixes.length - 1) {
|
||||
size /= 1024;
|
||||
i++;
|
||||
}
|
||||
return "${size.toStringAsFixed(2)} ${suffixes[i]}";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue