This commit is contained in:
Leon Bösche
2026-01-14 18:47:29 +01:00
parent 453b60032c
commit 3619dd2234

View File

@@ -45,6 +45,13 @@ class _FileExplorerState extends State<FileExplorer> {
ScaffoldFeatureController<SnackBar, SnackBarClosedReason>?
_uploadSnackBarController;
String _formatFileSize(int bytes) {
if (bytes < 1024) return '$bytes B';
if (bytes < 1024 * 1024) return '${(bytes / 1024).toStringAsFixed(1)} KB';
if (bytes < 1024 * 1024 * 1024) return '${(bytes / (1024 * 1024)).toStringAsFixed(1)} MB';
return '${(bytes / (1024 * 1024 * 1024)).toStringAsFixed(2)} GB';
}
String _getParentPath(String path) {
if (path == '/') return '/';
final parts = path.split('/').where((p) => p.isNotEmpty).toList();
@@ -984,7 +991,7 @@ class _FileExplorerState extends State<FileExplorer> {
subtitle: Text(
file.type == FileType.folder
? 'Folder'
: 'File - ${file.size} bytes',
: 'File - ${_formatFileSize(file.size)}',
style: const TextStyle(color: AppTheme.secondaryText),
),
trailing: Row(