filtering works!

This commit is contained in:
Odweta
2026-03-23 12:24:01 +01:00
parent ff655e2dcf
commit 1871dac2af
3 changed files with 94 additions and 25 deletions
+6 -3
View File
@@ -7,7 +7,6 @@ import 'package:frontend/repository/quote_repository.dart';
class QuoteProvider extends ChangeNotifier {
List<Quote> _quotes = [];
List<Quote> _filteredQuotes = [];
Set<String> _authors = {};
bool _loading = false;
String? _error;
@@ -40,6 +39,10 @@ class QuoteProvider extends ChangeNotifier {
filterController.text = '';
}
void filterQuotes() {
notifyListeners();
}
QuoteProvider() {
readQuotes(); // auto-load on creation
}
@@ -51,7 +54,8 @@ class QuoteProvider extends ChangeNotifier {
}
}
void filterQuotes() {
void setFilterBy(int value) {
filterBy = value;
notifyListeners();
}
@@ -62,7 +66,6 @@ class QuoteProvider extends ChangeNotifier {
try {
_quotes = await repo.readQuotes();
_filteredQuotes = _quotes;
} catch (e) {
_error = e.toString();
}