Add display of legs and top traction, adjust colour based on device theme
This commit is contained in:
@@ -10,6 +10,9 @@ class DataService extends ChangeNotifier {
|
||||
HomepageStats? _homepageStats;
|
||||
HomepageStats? get homepageStats => _homepageStats;
|
||||
|
||||
List<Leg> _legs = [];
|
||||
List<Leg> get legs => _legs;
|
||||
|
||||
bool _isHomepageLoading = false;
|
||||
bool get isHomepageLoading => _isHomepageLoading;
|
||||
|
||||
@@ -28,6 +31,23 @@ class DataService extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> fetchLegs({
|
||||
int offset = 0,
|
||||
int limit = 100,
|
||||
String sortBy = 'date',
|
||||
int sortDirection = 0,
|
||||
}) async {
|
||||
final query = '?sort_direction=$sortDirection&sort_by=$sortBy&offset=$offset&limit=$limit';
|
||||
final json = await api.get('/user/legs$query');
|
||||
|
||||
if (json is List) {
|
||||
_legs = json.map((e) => Leg.fromJson(e)).toList();
|
||||
notifyListeners();
|
||||
} else {
|
||||
throw Exception('Unexpected legs response: $json');
|
||||
}
|
||||
}
|
||||
|
||||
void clear() {
|
||||
_homepageStats = null;
|
||||
|
||||
Reference in New Issue
Block a user