minor home screen fix

This commit is contained in:
2026-05-29 23:54:17 +02:00
parent 287cb37048
commit d700ad609d
4 changed files with 60 additions and 37 deletions

View File

@@ -108,8 +108,11 @@ class HomeController extends ChangeNotifier {
model.isLoading = true;
if (!_disposed) notifyListeners();
List<dynamic> response = await http.get('/public/providers');
model.providers = response.map((e) => BillProvider.fromJson(e)).toList();
final response = await http.get('/public/providers?sort=priority,asc');
List<BillProvider> providers = PageableModel.fromJson(response).content
.map((e) => BillProvider.fromJson(e as Map<String, dynamic>))
.toList();
model.providers = providers;
model.filterableProviders = model.providers;
if (model.providers.isNotEmpty) {
@@ -141,7 +144,9 @@ class HomeController extends ChangeNotifier {
if (!_disposed) notifyListeners();
}
Future<ApiResponse<List<Map<String, dynamic>>>> getTransactions(String userId) async {
Future<ApiResponse<List<Map<String, dynamic>>>> getTransactions(
String userId,
) async {
model.isLoading = true;
if (!_disposed) notifyListeners();
@@ -179,8 +184,10 @@ class HomeController extends ChangeNotifier {
// Simulate fetching categories
try {
List<dynamic> response = await http.get('/public/categories');
model.categories = response.map((e) => Category.fromJson(e)).toList();
final response = await http.get('/public/categories');
model.categories = (response as List<dynamic>)
.map((e) => Category.fromJson(e as Map<String, dynamic>))
.toList();
if (model.categories.isNotEmpty) {
updateSelectedCategory(model.categories[0]);