Skip to content

swatv3nub/FinTrack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FinTrack - Smart Personal Finance & Expense Tracker

A cross-platform Flutter application for tracking personal expenses and budgets with analytics. Built with clean architecture, state management, and offline-first approach.

πŸ“± Features

Core Features

  • Dashboard

    • Real-time current balance (Income - Expenses)
    • Recent transactions list (last 10)
    • Interactive pie chart showing expenses by category
    • Responsive layout for all screen sizes
  • Transactions Management

    • Add, edit, and delete transactions
    • Categories for Income (Salary, Business, Investment, Gift, Other)
    • Categories for Expenses (Food, Travel, Bills, Shopping, Entertainment, Healthcare, Education, Other)
    • Input validation and error handling
    • Swipe-to-delete with undo functionality
    • Offline-first storage using Hive
    • Filter by transaction type (All, Income, Expense)
  • Budget Management

    • Set monthly budgets per category
    • Visual progress indicators with color-coded alerts
    • Budget status tracking:
      • 🟒 Green: Under 80% of budget
      • 🟠 Orange: 80-100% of budget (approaching limit)
      • πŸ”΄ Red: Over budget
    • Month navigation to view historical budgets

Bonus Features

  • βœ… Light/Dark Mode Toggle - System-aware theme with manual toggle
  • βœ… Smooth Animations - Animated charts and transitions
  • βœ… CSV Export - Export transactions to CSV format
    • Tap the download icon (πŸ“₯) in the Transactions screen app bar
    • File is saved to the Downloads folder on your device
    • Includes all filtered transactions (All/Income/Expense)
    • CSV columns: ID, Title, Amount, Date, Category, Type, Description
    • Can be opened in Excel, Google Sheets, or any CSV reader
  • βœ… Undo Delete - Restore accidentally deleted transactions
    • Swipe left on any transaction to delete it
    • A snackbar appears with an "UNDO" button
    • Tap "UNDO" within a few seconds to restore the transaction

πŸ—οΈ Architecture

Project Structure

lib/
β”œβ”€β”€ models/              # Data models with Hive adapters
β”‚   β”œβ”€β”€ transaction_model.dart
β”‚   β”œβ”€β”€ budget_model.dart
β”‚   └── *.g.dart        # Generated Hive adapters
β”œβ”€β”€ screens/            # UI screens
β”‚   β”œβ”€β”€ dashboard_screen.dart
β”‚   β”œβ”€β”€ transactions_screen.dart
β”‚   β”œβ”€β”€ budgets_screen.dart
β”‚   β”œβ”€β”€ add_transaction_screen.dart
β”‚   └── add_budget_screen.dart
β”œβ”€β”€ widgets/            # Reusable widgets
β”‚   β”œβ”€β”€ balance_card.dart
β”‚   β”œβ”€β”€ expense_chart.dart
β”‚   └── transaction_list_item.dart
β”œβ”€β”€ providers/          # State management
β”‚   β”œβ”€β”€ transaction_provider.dart
β”‚   β”œβ”€β”€ budget_provider.dart
β”‚   └── theme_provider.dart
β”œβ”€β”€ services/           # Business logic
β”‚   β”œβ”€β”€ storage_service.dart
β”‚   └── csv_export_service.dart
└── main.dart          # App entry point

test/
β”œβ”€β”€ models/            # Model tests
β”œβ”€β”€ widget_test.dart   # Widget and provider tests
└── ...

State Management

Choice: Provider

Provider was chosen for this project because:

  • βœ… Official Flutter recommendation
  • βœ… Simple and intuitive API
  • βœ… Excellent for small to medium apps
  • βœ… Great performance with ChangeNotifier
  • βœ… Easy testing and debugging
  • βœ… Built-in dependency injection

Alternative Considered:

  • Riverpod: More powerful but overkill for this scope
  • Bloc: More boilerplate, better for large teams

State Management Implementation

  • TransactionProvider: Manages transaction CRUD, balance calculations, category aggregations
  • BudgetProvider: Handles budget CRUD, budget status checks, alerts
  • ThemeProvider: Manages theme mode persistence and switching

Local Storage

Choice: Hive

Hive was selected because:

  • βœ… Fast, pure Dart NoSQL database
  • βœ… Type-safe with code generation
  • βœ… Excellent offline support
  • βœ… Minimal boilerplate
  • βœ… Cross-platform compatibility
  • βœ… Better performance than SQLite for this use case

Storage Boxes:

  • transactions: Stores all transaction records
  • budgets: Stores monthly budget configurations
  • settings: Stores app preferences (theme mode)

πŸš€ Setup Instructions

Prerequisites

  • Flutter SDK 3.0.0 or higher
  • Dart SDK 3.0.0 or higher
  • Android Studio / VS Code with Flutter extensions
  • Android SDK (for Android) or Xcode (for iOS)

Installation Steps

  1. Clone the repository
git clone https://github.com/swatv3nub/FinTrack.git
cd fintrack
  1. Install dependencies
flutter pub get
  1. Generate Hive adapters (already included in repo, but if needed)
flutter pub run build_runner build --delete-conflicting-outputs
  1. Run the app
# Debug mode
flutter run

# Release mode
flutter run --release

# Specific device
flutter run -d <device_id>
  1. Run tests
# All tests
flutter test

# With coverage
flutter test --coverage

# Specific test file
flutter test test/widget_test.dart

πŸ§ͺ Testing

Test Coverage

The project includes comprehensive testing:

  • βœ… Unit Tests

    • Transaction model tests (creation, copyWith, toMap)
    • Budget model tests (creation, copyWith, toMap)
    • Category validation tests
  • βœ… Widget Tests

    • BalanceCard display tests
    • TransactionListItem rendering tests
    • Theme switching tests
  • βœ… Provider Tests

    • Transaction CRUD operations
    • Balance calculations
    • Expense aggregation by category
    • Budget status checks
    • Undo delete functionality

Running Tests

# Run all tests
flutter test

# Run with coverage report
flutter test --coverage
lcov --summary coverage/lcov.info

# Run specific test suite
flutter test test/models/transaction_model_test.dart

Test Files

  • test/models/transaction_model_test.dart - Transaction model unit tests
  • test/models/budget_model_test.dart - Budget model unit tests
  • test/widget_test.dart - Widget and provider integration tests

πŸ“¦ Dependencies

Production Dependencies

provider: ^6.1.1          # State management
hive: ^2.2.3              # NoSQL database
hive_flutter: ^1.1.0      # Flutter integration for Hive
path_provider: ^2.1.1     # File system paths
fl_chart: ^0.65.0         # Beautiful charts
csv: ^5.1.1               # CSV export functionality
intl: ^0.18.1             # Internationalization
cupertino_icons: ^1.0.6   # iOS-style icons

Dev Dependencies

flutter_test:            # Testing framework
flutter_lints: ^3.0.1    # Flutter linting rules
hive_generator: ^2.0.1   # Hive adapter generator
build_runner: ^2.4.6     # Code generation

🎨 Design Decisions

UI/UX

  • Material Design 3 with custom theming
  • Card-based layout for better visual hierarchy
  • Color-coded indicators (green/orange/red) for budget status
  • Swipe gestures for intuitive deletion
  • Bottom navigation for easy access to main features
  • Pull-to-refresh on dashboard

Performance

  • Lazy loading of transactions with ListView.builder
  • Efficient state updates with ChangeNotifier
  • Offline-first approach reduces network dependency
  • Optimized chart rendering with fl_chart

Code Quality

  • Clean architecture with separation of concerns
  • Consistent naming conventions
  • Comprehensive documentation
  • Flutter lints enabled
  • Type-safe data models with Hive
  • Error handling and validation throughout

🚧 Future Enhancements

Potential improvements for future versions:

  • Multi-currency support
  • Cloud sync with Firebase
  • Recurring transactions
  • Advanced analytics and reports
  • Bill reminders and notifications
  • Biometric authentication
  • Data import from bank statements
  • Category customization
  • Budget templates

About

Smart Personal Finance & Expense Tracker App

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages