Sort files to show directories above files
This commit is contained in:
parent
d21dc26a18
commit
e6dd8482fa
@ -50,10 +50,13 @@ class _FilesState extends State<Files> {
|
||||
return const ErrorView(text: "Der Ordner ist leer", icon: Icons.folder_off_outlined);
|
||||
}
|
||||
|
||||
List<CacheableFile> files = value.listFilesResponse.files.toList();
|
||||
files.sort((a, b) => a.isDirectory ? -1 : 1);
|
||||
|
||||
return ListView.builder(
|
||||
itemCount: value.listFilesResponse.files.length,
|
||||
itemCount: files.length,
|
||||
itemBuilder: (context, index) {
|
||||
CacheableFile file = value.listFilesResponse.files.skip(index).first;
|
||||
CacheableFile file = files.skip(index).first;
|
||||
return FileElement(file, updateAppBar);
|
||||
},
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user