diff options
author | Orangerot <purple@orangerot.dev> | 2025-01-08 03:14:51 +0100 |
---|---|---|
committer | Orangerot <purple@orangerot.dev> | 2025-01-08 03:15:34 +0100 |
commit | 947570755edbb27d9aab939525b11659b246f896 (patch) | |
tree | 88eb7604c80013952dc9902321900fbd257382b7 /lib | |
parent | 9c229b94d0aa52679e12e50d62aa8e6cbf9fb9c5 (diff) |
feat: sort by title name in level selection
Diffstat (limited to 'lib')
-rw-r--r-- | lib/level_selection.dart | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/level_selection.dart b/lib/level_selection.dart index 0c1a0fe..44cf7ea 100644 --- a/lib/level_selection.dart +++ b/lib/level_selection.dart @@ -135,7 +135,7 @@ class _LevelSelectionState extends State<LevelSelection> { final directory = Directory(directoryPath); try { // List all files and folders in the directory - return directory + List<Simfile> simfiles = directory .listSync() .where((entity) => FileSystemEntity.isDirectorySync(entity.path)) .map((entity) { @@ -143,6 +143,9 @@ class _LevelSelectionState extends State<LevelSelection> { simfile.load(); return simfile; }).toList(); + simfiles.sort((a,b) => a.tags['TITLE']!.compareTo(b.tags['TITLE']!)); + + return simfiles; } catch (e) { print("Error reading directory: $e"); return []; |