current period $

This commit is contained in:
José Salazar
2026-01-26 18:42:17 -05:00
parent d67dfd6f2f
commit 3a4fa37a56

View File

@@ -64,11 +64,15 @@ class BillingBloc extends Bloc<BillingEvent, BillingState> {
.map(_mapInvoiceToUiModel)
.toList();
final List<SpendingBreakdownItem> uiSpendingBreakdown = _mapSpendingItemsToUiModel(spendingItems);
final double periodTotal = uiSpendingBreakdown.fold(
0.0,
(double sum, SpendingBreakdownItem item) => sum + item.amount,
);
emit(
state.copyWith(
status: BillingStatus.success,
currentBill: currentBill,
currentBill: periodTotal,
savings: savings,
pendingInvoices: uiPendingInvoices,
invoiceHistory: uiInvoiceHistory,
@@ -94,10 +98,15 @@ class BillingBloc extends Bloc<BillingEvent, BillingState> {
await _getSpendingBreakdown.call(event.period);
final List<SpendingBreakdownItem> uiSpendingBreakdown =
_mapSpendingItemsToUiModel(spendingItems);
final double periodTotal = uiSpendingBreakdown.fold(
0.0,
(double sum, SpendingBreakdownItem item) => sum + item.amount,
);
emit(
state.copyWith(
period: event.period,
spendingBreakdown: uiSpendingBreakdown,
currentBill: periodTotal,
),
);
} catch (e) {