idle
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user