@marcos_feitoza/personal-finance-frontend-feature-management 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/lib/screens/reconciliation_screen.dart +21 -22
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.0.2](https://github.com/MarcosOps/personal-finance-frontend-feature-management/compare/v1.0.1...v1.0.2) (2026-01-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* new SnackBar ([2249b0b](https://github.com/MarcosOps/personal-finance-frontend-feature-management/commit/2249b0b80d8983dc6636d9de3192a0e744696ae0))
|
|
7
|
+
|
|
8
|
+
## [1.0.1](https://github.com/MarcosOps/personal-finance-frontend-feature-management/compare/v1.0.0...v1.0.1) (2025-12-06)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* conversão double.parse ([5a88347](https://github.com/MarcosOps/personal-finance-frontend-feature-management/commit/5a8834708acb549d3e57ade9f8ad2e74a4a2cd5b))
|
|
14
|
+
|
|
1
15
|
# 1.0.0 (2025-11-28)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -3,6 +3,7 @@ import 'package:personal_finance_frontend_core_services/services/transaction_ser
|
|
|
3
3
|
import 'package:intl/intl.dart';
|
|
4
4
|
import 'package:personal_finance_frontend_core_services/models/payment_method.dart';
|
|
5
5
|
import 'package:personal_finance_frontend_core_ui/widgets/app_widgets.dart';
|
|
6
|
+
import 'package:personal_finance_frontend_core_ui/utils/app_snackbars.dart';
|
|
6
7
|
import 'package:provider/provider.dart';
|
|
7
8
|
import 'package:personal_finance_frontend_core_services/providers/auth_provider.dart';
|
|
8
9
|
|
|
@@ -32,9 +33,10 @@ class _ReconciliationScreenState extends State<ReconciliationScreen> {
|
|
|
32
33
|
@override
|
|
33
34
|
void initState() {
|
|
34
35
|
super.initState();
|
|
35
|
-
_selectedPaymentMethod =
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
_selectedPaymentMethod = widget.paymentMethod.isNotEmpty
|
|
37
|
+
? widget.paymentMethod.toUpperCase()
|
|
38
|
+
: null;
|
|
39
|
+
|
|
38
40
|
// Get token from AuthProvider
|
|
39
41
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
40
42
|
final authProvider = Provider.of<AuthProvider>(context, listen: false);
|
|
@@ -57,10 +59,13 @@ class _ReconciliationScreenState extends State<ReconciliationScreen> {
|
|
|
57
59
|
setState(() {
|
|
58
60
|
_isLoading = true;
|
|
59
61
|
});
|
|
60
|
-
final summary =
|
|
62
|
+
final summary =
|
|
63
|
+
await _transactionService.getSummaryByPaymentMethod(token: _token);
|
|
61
64
|
setState(() {
|
|
62
|
-
_availablePaymentMethods =
|
|
63
|
-
|
|
65
|
+
_availablePaymentMethods =
|
|
66
|
+
summary.map((s) => s['payment_method'] as String).toList();
|
|
67
|
+
if (_selectedPaymentMethod != null &&
|
|
68
|
+
!_availablePaymentMethods.contains(_selectedPaymentMethod)) {
|
|
64
69
|
_selectedPaymentMethod = null; // Clear selection if not in the new list
|
|
65
70
|
}
|
|
66
71
|
_isLoading = false;
|
|
@@ -107,7 +112,8 @@ class _ReconciliationScreenState extends State<ReconciliationScreen> {
|
|
|
107
112
|
_selectedTotal = 0;
|
|
108
113
|
for (int id in _selectedIds) {
|
|
109
114
|
final transaction = _unpaidTransactions.firstWhere((t) => t['id'] == id);
|
|
110
|
-
final double amount =
|
|
115
|
+
final double amount =
|
|
116
|
+
double.tryParse(transaction['amount']?.toString() ?? '0.0') ?? 0.0;
|
|
111
117
|
final String type = transaction['type'];
|
|
112
118
|
_selectedTotal += type == 'debit' ? amount : -amount;
|
|
113
119
|
}
|
|
@@ -115,17 +121,12 @@ class _ReconciliationScreenState extends State<ReconciliationScreen> {
|
|
|
115
121
|
|
|
116
122
|
Future<void> _reconcile() async {
|
|
117
123
|
if (_selectedIds.isEmpty) {
|
|
118
|
-
|
|
119
|
-
const SnackBar(
|
|
120
|
-
content: Text('Please select transactions to reconcile.')),
|
|
121
|
-
);
|
|
124
|
+
showInfoSnackBar(context, 'Please select transactions to reconcile.');
|
|
122
125
|
return;
|
|
123
126
|
}
|
|
124
127
|
|
|
125
128
|
if (_selectedPaymentMethod == null) {
|
|
126
|
-
|
|
127
|
-
const SnackBar(content: Text('Please select a payment method.')),
|
|
128
|
-
);
|
|
129
|
+
showInfoSnackBar(context, 'Please select a payment method.');
|
|
129
130
|
return;
|
|
130
131
|
}
|
|
131
132
|
|
|
@@ -137,15 +138,10 @@ class _ReconciliationScreenState extends State<ReconciliationScreen> {
|
|
|
137
138
|
);
|
|
138
139
|
|
|
139
140
|
if (newBalance != null) {
|
|
140
|
-
|
|
141
|
-
const SnackBar(content: Text('Reconciliation successful!')),
|
|
142
|
-
);
|
|
141
|
+
showSuccessSnackBar(context, 'Reconciliation successful!');
|
|
143
142
|
Navigator.of(context).pop(true); // Pop with a success result
|
|
144
143
|
} else {
|
|
145
|
-
|
|
146
|
-
const SnackBar(
|
|
147
|
-
content: Text('Reconciliation failed. Please try again.')),
|
|
148
|
-
);
|
|
144
|
+
showErrorSnackBar(context, 'Reconciliation failed. Please try again.');
|
|
149
145
|
}
|
|
150
146
|
}
|
|
151
147
|
|
|
@@ -191,7 +187,10 @@ class _ReconciliationScreenState extends State<ReconciliationScreen> {
|
|
|
191
187
|
],
|
|
192
188
|
rows: _unpaidTransactions.map((transaction) {
|
|
193
189
|
final transactionId = transaction['id'] as int;
|
|
194
|
-
final amount = double.
|
|
190
|
+
final double amount = double.tryParse(
|
|
191
|
+
transaction['amount']?.toString() ??
|
|
192
|
+
'0.0') ??
|
|
193
|
+
0.0;
|
|
195
194
|
return DataRow(
|
|
196
195
|
cells: [
|
|
197
196
|
DataCell(Checkbox(
|