Fixed bugs
This commit is contained in:
@@ -31,9 +31,17 @@ class _ReceivePaymentSheetState extends ConsumerState<ReceivePaymentSheet> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final walletsState = ref.watch(walletProvider);
|
||||
final wallets = walletsState.value ?? [];
|
||||
final allWallets = walletsState.value ?? [];
|
||||
|
||||
if (wallets.isNotEmpty && _selectedWalletId == null) {
|
||||
final wallets = allWallets.where((w) {
|
||||
if (_paymentMethod == 'Cash') {
|
||||
return w.nature == 'CASH';
|
||||
} else {
|
||||
return w.nature == 'INCOME' || w.nature == 'SAVINGS';
|
||||
}
|
||||
}).toList();
|
||||
|
||||
if (wallets.isNotEmpty && (_selectedWalletId == null || !wallets.any((w) => w.id == _selectedWalletId))) {
|
||||
_selectedWalletId = wallets.first.id;
|
||||
}
|
||||
|
||||
@@ -102,7 +110,14 @@ class _ReceivePaymentSheetState extends ConsumerState<ReceivePaymentSheet> {
|
||||
items: ['Cash', 'UPI', 'Bank Transfer', 'Card']
|
||||
.map((m) => DropdownMenuItem(value: m, child: Text(m)))
|
||||
.toList(),
|
||||
onChanged: (val) => setState(() => _paymentMethod = val!),
|
||||
onChanged: (val) {
|
||||
if (val != null) {
|
||||
setState(() {
|
||||
_paymentMethod = val;
|
||||
_selectedWalletId = null;
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user