Release v1.2.11+14
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:
-
Local Data Persistence with Hive & State Management (Fixes #17):
- Dependencies: Added
hive_ce,hive_ce_flutter,hive_ce_generator, andbuild_runnertopubspec.yamlto enable local database functionality. - Data Models (
lib/models/): UpdatedBillDataandBillItemmodels 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 theBillStorageServiceand usesMultiProviderto make the service available throughout the widget tree. This provides a clean way to access the database service from any part of the app.
- Dependencies: Added
-
Bill Confirmation Logic (Fixes #14):
- In
lib/screens/verifikasi_screens/bill_details_screen.dart, the_konfirmasiBillmethod has been updated. - It now uses the
BillStorageService(accessed viaProvider) to save theBillDataobject to the local Hive database when the user presses the "Konfirmasi" button, ensuring transaction data is persisted.
- In
-
Dynamic History Page & Price Formatting Fix (Fixes #27):
- Data Fetching: The
HistoryScreen(lib/screens/history_screen.dart) has been converted to aStatefulWidget. It no longer uses mock data; instead, it fetches all stored bills from Hive using theBillStorageServiceon 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
DailyExpenditureobjects, which are then displayed in descending order. - Price Formatting: In
lib/widgets/history/daily_expenditure_card.dartandlib/widgets/history/history_list_item.dart, the price display has been corrected. It now usesNumberFormat.currencywith theidlocale to correctly format amounts in Indonesian Rupiah (Rp), resolving the incorrect currency symbol and formatting.
- Data Fetching: The
Minor Refinements:
- UI Cleanup: Removed an unnecessary
Centerwidget fromhome_screen.dartto allow body content to fill the screen as intended. - Widget Organization: Reorganized loading indicator widgets and introduced a new
LoadingScreenfor a better user experience during data fetching operations.
Affected Files:
pubspec.yamlpubspec.locklib/main.dartlib/models/bill_data.dartlib/models/bill_item.dartlib/screens/history_screen.dartlib/screens/home_screen.dartlib/screens/verifikasi_screens/bill_details_screen.dartlib/widgets/history/daily_expenditure_card.dartlib/widgets/history/history_list_item.dartlib/widgets/loading_screen.dartlib/widgets/loading/loading_overlay.dartlib/services/bill_storage_service.dartlib/hive_registrar.g.dartlib/models/bill_data.g.dartlib/models/bill_item.g.dart