diff --git a/lib/ui/pages/budgets/budget_details.dart b/lib/ui/pages/budgets/budget_details.dart index ac4d8b5..c197fce 100644 --- a/lib/ui/pages/budgets/budget_details.dart +++ b/lib/ui/pages/budgets/budget_details.dart @@ -126,6 +126,7 @@ class BudgetDetailsPage extends StatelessWidget { ); } + final totalSpent = spending.isEmpty ? 0 : spending.values.reduce((acc, val) => acc + val); final budgetTotal = state.activeBudget!.items .map((i) => i.amount) .reduce((acc, val) => acc + val); @@ -170,6 +171,38 @@ class BudgetDetailsPage extends StatelessWidget { ), ), ), + Padding( + padding: EdgeInsets.all(8), + child: SizedBox( + height: 100, + width: 150, + child: Card( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "Budget left", + textAlign: TextAlign.center, + style: + Theme.of( + context, + ).textTheme.titleLarge, + ), + Text( + formatCurrency(budgetTotal + totalSpent), + textAlign: TextAlign.center, + style: + Theme.of( + context, + ).textTheme.bodyLarge, + ), + ], + ), + ), + ), + ), Padding( padding: EdgeInsets.all(8), child: SizedBox(