Add display of legs and top traction, adjust colour based on device theme

This commit is contained in:
2025-07-25 02:03:10 +01:00
parent 652e83bf38
commit 985eddb35a
15 changed files with 316 additions and 64 deletions

View File

@@ -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;