filtering works!
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user