ui improvements

This commit is contained in:
2025-09-01 20:17:08 +02:00
parent daf4450f7a
commit 6e2f91d2c0
30 changed files with 1822 additions and 224 deletions

View File

@@ -11,6 +11,7 @@ class HomeScreenModel {
List<Category> categories = [];
List<BillProvider> providers = [];
List<BillProvider> filterableProviders = [];
List<Account> accounts = [];
BillProvider? selectedProvider;
dynamic selectedCategory;
dynamic account = {};
@@ -20,6 +21,26 @@ class HomeScreenModel {
String? errorMessage;
}
class Account {
late String name;
late String description;
late String image;
late String currency;
late String balance;
late String availableBalance;
late String accountNumber;
late String accountType;
late String accountHolderName;
Account({
required this.name,
required this.description,
required this.image,
required this.currency,
required this.balance,
});
}
@freezed
abstract class Category with _$Category {
const factory Category({
@@ -76,12 +97,17 @@ class HomeController extends ChangeNotifier {
});
}
Future<void> getAccounts() async {
model.accounts = getFakeAccounts();
notifyListeners();
}
Future<void> getProviders() async {
try {
model.isLoading = true;
notifyListeners();
List<dynamic> response = await http.get('/providers');
List<dynamic> response = await http.get('/public/providers');
model.providers = response.map((e) => BillProvider.fromJson(e)).toList();
model.filterableProviders = model.providers;
@@ -116,7 +142,7 @@ class HomeController extends ChangeNotifier {
try {
Map<String, dynamic> response = await http.get(
'/transaction?sort=createdAt,desc&size=3&page=0&userId=$userId&type=REQUEST',
'/public/transaction?sort=createdAt,desc&size=3&page=0&userId=$userId&type=REQUEST',
);
PageableModel pageableModel = PageableModel.fromJson(response);
@@ -146,7 +172,7 @@ class HomeController extends ChangeNotifier {
// Simulate fetching categories
try {
List<dynamic> response = await http.get('/categories');
List<dynamic> response = await http.get('/public/categories');
model.categories = response.map((e) => Category.fromJson(e)).toList();
if (model.categories.isNotEmpty) {
@@ -246,4 +272,23 @@ class HomeController extends ChangeNotifier {
),
];
}
List<Account> getFakeAccounts() {
return [
Account(
name: 'Vusumuzi Khoza',
description: 'USD Wallet',
image: 'united-states.png',
currency: 'USD',
balance: '4.02',
),
Account(
name: 'Vusumuzi Khoza',
description: 'ZWG Wallet',
image: 'zimbabwe.png',
currency: 'ZWL',
balance: '36.00',
),
];
}
}