Skip to content

Release v1.2.11+14

Choose a tag to compare

@github-actions github-actions released this 08 Jun 11:12
1beba62

Automated release triggered by merge of PR #28:
Version: v1.2.11+14
Title: feat: Save transactions locally and fix history display formatting
Author: SjdnDzikran
Link: #28

This PR addresses the following:

This PR introduces a major feature enhancement by integrating the Hive database for local data persistence. It also establishes a foundational state management pattern using Provider, resolves the bill confirmation logic, and fixes display issues on the history page.

Summary of Changes:

  1. Local Data Persistence with Hive & State Management (Fixes #17):

    • Dependencies: Added hive_ce, hive_ce_flutter, hive_ce_generator, and build_runner to pubspec.yaml to enable local database functionality.
    • Data Models (lib/models/): Updated BillData and BillItem models with Hive annotations (@HiveType, @HiveField) and generated adapter files (.g.dart) to make them compatible with Hive.
    • Service Layer: Created a new BillStorageService (lib/services/bill_storage_service.dart) to encapsulate all Hive database operations, such as initializing the database, saving bills, and fetching all saved bills.
    • State Management (lib/main.dart): The application's entry point now initializes the BillStorageService and uses MultiProvider to make the service available throughout the widget tree. This provides a clean way to access the database service from any part of the app.
  2. Bill Confirmation Logic (Fixes #14):

    • In lib/screens/verifikasi_screens/bill_details_screen.dart, the _konfirmasiBill method has been updated.
    • It now uses the BillStorageService (accessed via Provider) to save the BillData object to the local Hive database when the user presses the "Konfirmasi" button, ensuring transaction data is persisted.
  3. Dynamic History Page & Price Formatting Fix (Fixes #27):

    • Data Fetching: The HistoryScreen (lib/screens/history_screen.dart) has been converted to a StatefulWidget. It no longer uses mock data; instead, it fetches all stored bills from Hive using the BillStorageService on initialization. A loading indicator is now shown while the data is being fetched.
    • Data Aggregation: Fetched bills are grouped by date to create a list of DailyExpenditure objects, which are then displayed in descending order.
    • Price Formatting: In lib/widgets/history/daily_expenditure_card.dart and lib/widgets/history/history_list_item.dart, the price display has been corrected. It now uses NumberFormat.currency with the id locale to correctly format amounts in Indonesian Rupiah (Rp), resolving the incorrect currency symbol and formatting.

Minor Refinements:

  • UI Cleanup: Removed an unnecessary Center widget from home_screen.dart to allow body content to fill the screen as intended.
  • Widget Organization: Reorganized loading indicator widgets and introduced a new LoadingScreen for a better user experience during data fetching operations.

Affected Files:

  • pubspec.yaml
  • pubspec.lock
  • lib/main.dart
  • lib/models/bill_data.dart
  • lib/models/bill_item.dart
  • lib/screens/history_screen.dart
  • lib/screens/home_screen.dart
  • lib/screens/verifikasi_screens/bill_details_screen.dart
  • lib/widgets/history/daily_expenditure_card.dart
  • lib/widgets/history/history_list_item.dart
  • lib/widgets/loading_screen.dart
  • lib/widgets/loading/loading_overlay.dart
  • lib/services/bill_storage_service.dart
  • lib/hive_registrar.g.dart
  • lib/models/bill_data.g.dart
  • lib/models/bill_item.g.dart