Home Dashboard
The Home Dashboard is the main landing page after onboarding, providing a comprehensive overview of the user’s financial status.
Overview
Section titled “Overview”File: lib/app/pages/client/home/home_view.dart
The home view displays:
- Total balance across all wallets
- Income and expense summaries
- Recent transactions list
- Quick action buttons
Components
Section titled “Components”Overview Card
Section titled “Overview Card”File: lib/app/pages/client/home/components/_overview_card.dart
Shows financial summary at a glance:
OverviewCardWidget( totalBalance: 5000.00, totalIncome: 3000.00, totalExpense: 1500.00, currency: CurrencyMock.usd,)Features:
- Large balance display with currency symbol
- Income vs Expense comparison
- Color-coded indicators (green for income, red for expense)
- Percentage change indicators
Recent Transactions
Section titled “Recent Transactions”Displays the last 5-10 transactions with:
- Transaction category icon
- Transaction name/notes
- Amount with type indicator
- Date
Architecture
Section titled “Architecture”State Management
Section titled “State Management”class HomeView extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final userAsync = ref.watch(authUserServiceProvider); final currency = ref.watch(userCurrencyProvider);
return userAsync.when( data: (user) => _buildContent(user, currency), loading: () => const HomeSkeleton(), error: (err, _) => ErrorWidget(err), ); }}Data Flow
Section titled “Data Flow”- AuthUserService provides user data including currency
- Mock data or API provides transactions
- Calculated totals from transaction lists
- UI updates automatically when data changes
Calculations
Section titled “Calculations”Total Balance
Section titled “Total Balance”double get totalBalance => wallets.fold( 0, (sum, wallet) => sum + wallet.balance,);Income Summary
Section titled “Income Summary”double get totalIncome => transactions .where((t) => t.type == TransactionType.income) .fold(0, (sum, t) => sum + t.amount);Expense Summary
Section titled “Expense Summary”double get totalExpense => transactions .where((t) => t.type == TransactionType.expense) .fold(0, (sum, t) => sum + t.amount);UI Layout
Section titled “UI Layout”┌─────────────────────────────────────┐│ Overview Card ││ ┌───────────────────────────────┐ ││ │ Total Balance │ ││ │ $5,000.00 │ ││ │ │ ││ │ Income $3,000 Expense $1,500│ ││ └───────────────────────────────┘ │├─────────────────────────────────────┤│ Recent Transactions ││ ┌───────────────────────────────┐ ││ │ 🍔 Food -$25.00 Dec │ ││ │ 💰 Salary +$3000.00 Dec │ ││ │ 🚗 Transport -$50.00 Nov │ ││ └───────────────────────────────┘ │├─────────────────────────────────────┤│ [See All] │└─────────────────────────────────────┘Customization
Section titled “Customization”Change Displayed Transaction Count
Section titled “Change Displayed Transaction Count”In home_view.dart:
final recentTransactions = transactions.take(10).toList(); // Change to 10Add New Overview Metrics
Section titled “Add New Overview Metrics”Add to OverviewCardWidget:
class OverviewCardWidget extends StatelessWidget { final double totalBalance; final double totalIncome; final double totalExpense; final double savingsRate; // Add new metric // ...}Custom Colors
Section titled “Custom Colors”The overview card uses theme colors automatically. To customize:
Container( decoration: BoxDecoration( gradient: LinearGradient( colors: [ theme.colorScheme.primary, theme.colorScheme.secondary, ], ), ),)Best Practices
Section titled “Best Practices”- Show loading states while data loads
- Format currency with correct symbols
- Limit transactions shown (5-10 max)
- Use relative dates (“Today”, “Yesterday”)
- Highlight important metrics (balance)
- Enable quick actions (add transaction button)
Testing
Section titled “Testing”testWidgets('HomeView displays balance correctly', (tester) async { await tester.pumpWidget( ProviderScope( child: MaterialApp(home: HomeView()), ), );
expect(find.text(r'$5,000.00'), findsOneWidget); expect(find.text('Total Balance'), findsOneWidget);});