mirror of
https://github.com/koloideal/Casha.git
synced 2026-06-10 10:25:28 +03:00
update
This commit is contained in:
@@ -5,7 +5,9 @@ import '../../core/services/card_color_service.dart';
|
||||
import '../../core/utils/result.dart';
|
||||
import '../../data/database/app_database.dart' as db;
|
||||
import '../../data/repositories/transaction_repository.dart';
|
||||
import '../../data/repositories/account_repository.dart';
|
||||
import '../../shared/models/transaction.dart';
|
||||
import '../../shared/models/account.dart';
|
||||
import '../../shared/services/storage_service.dart';
|
||||
import '../settings/provider.dart';
|
||||
|
||||
@@ -22,6 +24,11 @@ final transactionRepositoryProvider = Provider<TransactionRepository>((ref) {
|
||||
return TransactionRepository(db);
|
||||
});
|
||||
|
||||
final accountRepositoryProvider = Provider<AccountRepository>((ref) {
|
||||
final db = ref.watch(appDatabaseProvider);
|
||||
return AccountRepository(db);
|
||||
});
|
||||
|
||||
final storageServiceProvider = Provider<StorageService>((ref) {
|
||||
return StorageService(ref.watch(sharedPreferencesProvider));
|
||||
});
|
||||
@@ -217,6 +224,18 @@ final recentTransactionsProvider = Provider<List<Transaction>>((ref) {
|
||||
return ref.watch(filteredTransactionsProvider).take(20).toList();
|
||||
});
|
||||
|
||||
// Watches the list of all accounts
|
||||
final accountsProvider = StreamProvider<List<Account>>((ref) async* {
|
||||
final repository = ref.watch(accountRepositoryProvider);
|
||||
while (true) {
|
||||
yield await repository.getAll();
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
}
|
||||
});
|
||||
|
||||
// Ephemeral UI state — active carousel index, starts at 0, not persisted
|
||||
final activeAccountIndexProvider = StateProvider<int>((ref) => 0);
|
||||
|
||||
class CardColors {
|
||||
final Color primary;
|
||||
final Color secondary;
|
||||
|
||||
Reference in New Issue
Block a user