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