From 3a4fa37a56b1f9f68dd414b9b7e77da859b2c214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Salazar?= <73718835+joshrs23@users.noreply.github.com> Date: Mon, 26 Jan 2026 18:42:17 -0500 Subject: [PATCH] current period $ --- .../lib/src/presentation/blocs/billing_bloc.dart | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/mobile/packages/features/client/billing/lib/src/presentation/blocs/billing_bloc.dart b/apps/mobile/packages/features/client/billing/lib/src/presentation/blocs/billing_bloc.dart index d6e3c7fb..dc72ab2f 100644 --- a/apps/mobile/packages/features/client/billing/lib/src/presentation/blocs/billing_bloc.dart +++ b/apps/mobile/packages/features/client/billing/lib/src/presentation/blocs/billing_bloc.dart @@ -64,11 +64,15 @@ class BillingBloc extends Bloc { .map(_mapInvoiceToUiModel) .toList(); final List 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 { await _getSpendingBreakdown.call(event.period); final List 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) {