mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-16 21:33:41 +00:00
feat: flutter ui integration
This commit is contained in:
1 parent
0fc133e46d
commit
c4a30dc4c2
170 files changed
+7783
-1
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import 'dart:io';
|
||||
|
||||
class Util {
|
||||
static String fmtByte(int byte) {
|
||||
if (byte < 1024) {
|
||||
return "$byte B";
|
||||
} else if (byte < 1024 * 1024) {
|
||||
return "${(byte / 1024).toStringAsFixed(2)} KB";
|
||||
} else if (byte < 1024 * 1024 * 1024) {
|
||||
return "${(byte / 1024 / 1024).toStringAsFixed(2)} MB";
|
||||
} else {
|
||||
return "${(byte / 1024 / 1024 / 1024).toStringAsFixed(2)} GB";
|
||||
}
|
||||
}
|
||||
|
||||
static String buildPath(String path, String name) {
|
||||
return (path == "" ? "" : "$path/") + name;
|
||||
}
|
||||
|
||||
static String buildAbsPath(String dir, String path, String name) {
|
||||
return (dir == "" ? "" : "$dir/") + buildPath(path, name);
|
||||
}
|
||||
|
||||
static isDesktop() {
|
||||
return Platform.isWindows || Platform.isLinux || Platform.isMacOS;
|
||||
}
|
||||
|
||||
static isUnix() {
|
||||
return !Platform.isWindows;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user