chore: initialize Guangya Flutter project

This commit is contained in:
ngfchl
2026-07-18 10:23:34 +08:00
commit 6bcc3fdf18
143 changed files with 13939 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
extension StringExtensions on String {
String truncate(int maxLen) {
if (length <= maxLen) return this;
return '${substring(0, maxLen)}';
}
}
extension IntExtensions on int {
String get formattedBytes {
if (this < 1024) return '$this B';
if (this < 1024 * 1024) {
return '${(this / 1024).toStringAsFixed(1)} KB';
}
if (this < 1024 * 1024 * 1024) {
return '${(this / (1024 * 1024)).toStringAsFixed(1)} MB';
}
return '${(this / (1024 * 1024 * 1024)).toStringAsFixed(1)} GB';
}
}