feat: add file panel column view and folder sizes

This commit is contained in:
ngfchl
2026-07-18 11:58:47 +08:00
parent 4b39bc1eae
commit 01a536af1b
5 changed files with 472 additions and 22 deletions
+27
View File
@@ -93,6 +93,33 @@ class CloudFile {
return _formatBytes(size!);
}
CloudFile copyWith({
String? id,
String? name,
bool? isDirectory,
int? size,
bool clearSize = false,
String? gcid,
int? subDirectoryCount,
int? subFileCount,
String? modifiedAt,
String? cloudPath,
int? fileType,
}) {
return CloudFile(
id: id ?? this.id,
name: name ?? this.name,
isDirectory: isDirectory ?? this.isDirectory,
size: clearSize ? null : (size ?? this.size),
gcid: gcid ?? this.gcid,
subDirectoryCount: subDirectoryCount ?? this.subDirectoryCount,
subFileCount: subFileCount ?? this.subFileCount,
modifiedAt: modifiedAt ?? this.modifiedAt,
cloudPath: cloudPath ?? this.cloudPath,
fileType: fileType ?? this.fileType,
);
}
static String _formatBytes(int bytes) {
if (bytes < 1024) return '$bytes B';
if (bytes < 1024 * 1024) return '${(bytes / 1024).toStringAsFixed(1)} KB';