mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-26 16:46:51 +08:00
SortedNotesFolder: ensure reverse sort
This commit is contained in:
@ -17,7 +17,7 @@ class SortedNotesFolder with NotesFolderNotifier implements NotesFolder {
|
||||
folder.addListener(_entityChanged);
|
||||
|
||||
_notes = folder.notes;
|
||||
_notes.sort();
|
||||
_notes.sort(_compare);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -45,7 +45,7 @@ class SortedNotesFolder with NotesFolderNotifier implements NotesFolder {
|
||||
var i = 0;
|
||||
for (; i < _notes.length; i++) {
|
||||
var n = _notes[i];
|
||||
if (n.compareTo(note) > 0) {
|
||||
if (_compare(n, note) > 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -65,6 +65,10 @@ class SortedNotesFolder with NotesFolderNotifier implements NotesFolder {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
int _compare(Note a, Note b) {
|
||||
return b.compareTo(a);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Note> get notes => _notes;
|
||||
|
||||
|
Reference in New Issue
Block a user