refactor: Use adaptive dialog action
This commit is contained in:
parent
416cdc139f
commit
d1e211adee
9 changed files with 60 additions and 25 deletions
|
|
@ -1,18 +1,21 @@
|
|||
extension SizeString on num {
|
||||
String get sizeString {
|
||||
var size = toDouble();
|
||||
if (size < 1000000) {
|
||||
if (size < 1000) {
|
||||
return '${size.round()} Bytes';
|
||||
}
|
||||
if (size < 1000 * 1000) {
|
||||
size = size / 1000;
|
||||
size = (size * 10).round() / 10;
|
||||
return '${size.toString()} KB';
|
||||
} else if (size < 1000000000) {
|
||||
}
|
||||
if (size < 1000 * 1000 * 1000) {
|
||||
size = size / 1000000;
|
||||
size = (size * 10).round() / 10;
|
||||
return '${size.toString()} MB';
|
||||
} else {
|
||||
size = size / 1000000000;
|
||||
size = (size * 10).round() / 10;
|
||||
return '${size.toString()} GB';
|
||||
}
|
||||
size = size / 1000 * 1000 * 1000 * 1000;
|
||||
size = (size * 10).round() / 10;
|
||||
return '${size.toString()} GB';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue