added correct sorting of quotes in the list; set up a testing environment

This commit is contained in:
odweta
2026-04-02 19:58:41 +02:00
parent c9d39a7193
commit 51ce826de6
3 changed files with 11 additions and 5 deletions
+6 -1
View File
@@ -18,7 +18,7 @@ class QuoteProvider extends ChangeNotifier {
List<Quote> get filteredQuotes {
final query = filterController.text.toLowerCase();
return _quotes.where((quote) {
final filtered = _quotes.where((quote) {
switch (filterBy) {
case 0:
return quote.author.toLowerCase().contains(query);
@@ -28,6 +28,11 @@ class QuoteProvider extends ChangeNotifier {
return true;
}
}).toList();
// sort descending
filtered.sort((a, b) => b.id.compareTo(a.id));
return filtered;
}
final QuoteRepository repo = QuoteRepository();