idle
This commit is contained in:
@@ -45,6 +45,13 @@ class _FileExplorerState extends State<FileExplorer> {
|
|||||||
ScaffoldFeatureController<SnackBar, SnackBarClosedReason>?
|
ScaffoldFeatureController<SnackBar, SnackBarClosedReason>?
|
||||||
_uploadSnackBarController;
|
_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) {
|
String _getParentPath(String path) {
|
||||||
if (path == '/') return '/';
|
if (path == '/') return '/';
|
||||||
final parts = path.split('/').where((p) => p.isNotEmpty).toList();
|
final parts = path.split('/').where((p) => p.isNotEmpty).toList();
|
||||||
@@ -984,7 +991,7 @@ class _FileExplorerState extends State<FileExplorer> {
|
|||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
file.type == FileType.folder
|
file.type == FileType.folder
|
||||||
? 'Folder'
|
? 'Folder'
|
||||||
: 'File - ${file.size} bytes',
|
: 'File - ${_formatFileSize(file.size)}',
|
||||||
style: const TextStyle(color: AppTheme.secondaryText),
|
style: const TextStyle(color: AppTheme.secondaryText),
|
||||||
),
|
),
|
||||||
trailing: Row(
|
trailing: Row(
|
||||||
|
|||||||
Reference in New Issue
Block a user