added correct sorting of quotes in the list; set up a testing environment
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
// talks to the DB itself
|
||||
// TODO: implement the real one
|
||||
|
||||
import 'dart:convert';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import 'package:frontend/model/quote.dart';
|
||||
|
||||
class QuoteRepository {
|
||||
static final String _apiBaseUrl = 'https://hlaskovnik-reimagined-latest.onrender.com';
|
||||
//static final String _realApiBaseUrl = 'https://hlaskovnik-reimagined-latest.onrender.com';
|
||||
static final String _testApiBaseUrl = 'http://localhost:8080';
|
||||
static final String _apiBaseUrl = _testApiBaseUrl;
|
||||
static final String _apiKey = "2ogD5kc4sw3JVZoouQSV0w3LGRjSj5IjVFnAnk7IRCIK0ktONCeoOYinbNLSIHuU";
|
||||
static final String _quotesEndpoint = '/quotes';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user