mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-30 03:19:11 +08:00
Sort Folders based on name
Eventually this sorting should be configurable.
This commit is contained in:
@ -7,7 +7,7 @@ import 'package:path/path.dart';
|
||||
import 'note.dart';
|
||||
import 'note_fs_entity.dart';
|
||||
|
||||
class NotesFolder with ChangeNotifier {
|
||||
class NotesFolder with ChangeNotifier implements Comparable<NotesFolder> {
|
||||
final NotesFolder parent;
|
||||
String folderPath;
|
||||
|
||||
@ -78,7 +78,9 @@ class NotesFolder with ChangeNotifier {
|
||||
}
|
||||
|
||||
List<NotesFolder> getFolders() {
|
||||
return _entities.where((e) => e.isFolder).map((e) => e.folder).toList();
|
||||
var list = _entities.where((e) => e.isFolder).map((e) => e.folder).toList();
|
||||
list.sort();
|
||||
return list;
|
||||
}
|
||||
|
||||
// FIXME: This asynchronously loads everything. Maybe it should just list them, and the individual _entities
|
||||
@ -271,4 +273,9 @@ class NotesFolder with ChangeNotifier {
|
||||
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@override
|
||||
int compareTo(NotesFolder other) {
|
||||
return folderPath.compareTo(other.folderPath);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user