Beneficiary lists changed

This commit is contained in:
2025-11-20 13:31:42 +05:30
parent 4fe6af4098
commit f0d5233afc
3 changed files with 120 additions and 109 deletions

View File

@@ -97,32 +97,35 @@ class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
itemCount: _filteredBeneficiaries.length, itemCount: _filteredBeneficiaries.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final item = _filteredBeneficiaries[index]; final item = _filteredBeneficiaries[index];
return ListTile( return Card(
leading: CircleAvatar( margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
radius: 24, child: ListTile(
backgroundColor: Colors.transparent, leading: CircleAvatar(
child: getBankLogo(item.bankName, context), radius: 24,
), backgroundColor: Colors.transparent,
title: Text(item.name), child: getBankLogo(item.bankName, context),
subtitle: Column( ),
crossAxisAlignment: CrossAxisAlignment.start, title: Text(item.name),
children: [ subtitle: Column(
Text(item.accountNo), crossAxisAlignment: CrossAxisAlignment.start,
if (item.bankName != null && item.bankName!.isNotEmpty) children: [
Text( Text(item.accountNo),
item.bankName!, if (item.bankName != null && item.bankName!.isNotEmpty)
style: TextStyle(fontSize: 12, color: Colors.grey[600]), Text(
item.bankName!,
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
),
],
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => BeneficiaryDetailsScreen(beneficiary: item),
), ),
], );
},
), ),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => BeneficiaryDetailsScreen(beneficiary: item),
),
);
},
); );
}, },
); );

View File

@@ -120,60 +120,63 @@ class _FundTransferBeneficiaryScreenState
// By wrapping the ListTile in an Opacity widget, we can make it look // By wrapping the ListTile in an Opacity widget, we can make it look
// disabled while ensuring the onTap callback still works. // disabled while ensuring the onTap callback still works.
return Opacity( return Card(
opacity: isCoolingDown ? 0.5 : 1.0, margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
child: ListTile( child: Opacity(
// REMOVED the 'enabled' property from here. opacity: isCoolingDown ? 0.5 : 1.0,
leading: CircleAvatar( child: ListTile(
radius: 24, // REMOVED the 'enabled' property from here.
backgroundColor: Colors.transparent, leading: CircleAvatar(
child: getBankLogo(beneficiary.bankName, context), radius: 24,
), backgroundColor: Colors.transparent,
title: Text(beneficiary.name), child: getBankLogo(beneficiary.bankName, context),
subtitle: Column( ),
crossAxisAlignment: CrossAxisAlignment.start, title: Text(beneficiary.name),
children: [ subtitle: Column(
Text(beneficiary.accountNo), crossAxisAlignment: CrossAxisAlignment.start,
if (beneficiary.bankName != null && children: [
beneficiary.bankName!.isNotEmpty) Text(beneficiary.accountNo),
Text( if (beneficiary.bankName != null &&
beneficiary.bankName!, beneficiary.bankName!.isNotEmpty)
style: TextStyle(fontSize: 12, color: Colors.grey[600]), Text(
), beneficiary.bankName!,
], style: TextStyle(fontSize: 12, color: Colors.grey[600]),
),
trailing: isCoolingDown
? CooldownTimer(
createdAt: beneficiary.createdAt!,
onTimerFinish: () {
setState(() {});
},
)
: null,
onTap: () {
if (isCoolingDown) {
// This will now execute correctly on tap
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text(
'Beneficiary will be enabled after the cooldown period.'),
behavior: SnackBarBehavior.floating,
),
);
} else {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => FundTransferAmountScreen(
debitAccountNo: widget.creditAccountNo,
creditBeneficiary: beneficiary,
remitterName: widget.remitterName,
isOwnBank: widget.isOwnBank,
), ),
), ],
); ),
} trailing: isCoolingDown
}, ? CooldownTimer(
createdAt: beneficiary.createdAt!,
onTimerFinish: () {
setState(() {});
},
)
: null,
onTap: () {
if (isCoolingDown) {
// This will now execute correctly on tap
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text(
'Beneficiary will be enabled after the cooldown period.'),
behavior: SnackBarBehavior.floating,
),
);
} else {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => FundTransferAmountScreen(
debitAccountNo: widget.creditAccountNo,
creditBeneficiary: beneficiary,
remitterName: widget.remitterName,
isOwnBank: widget.isOwnBank,
),
),
);
}
},
),
), ),
); );
}, },

View File

@@ -55,39 +55,44 @@ class FundTransferSelfAccountsScreen extends StatelessWidget {
itemCount: filteredAccounts.length, itemCount: filteredAccounts.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final account = filteredAccounts[index]; final account = filteredAccounts[index];
return ListTile( return Card(
leading: CircleAvatar( margin: const EdgeInsets.symmetric(
radius: 24, horizontal: 12, vertical: 6),
backgroundColor: Colors.transparent, child: ListTile(
child: getBankLogo( leading: CircleAvatar(
'Kangra Central Co-operative Bank', context), radius: 24,
), backgroundColor: Colors.transparent,
title: Text(account.name ?? 'N/A'), child: getBankLogo(
subtitle: Column( 'Kangra Central Co-operative Bank', context),
crossAxisAlignment: CrossAxisAlignment.start, ),
children: [ title: Text(account.name ?? 'N/A'),
Text(account.accountNo ?? 'N/A'), subtitle: Column(
Text( crossAxisAlignment: CrossAxisAlignment.start,
_getFullAccountType(account.accountType), children: [
style: TextStyle( Text(account.accountNo ?? 'N/A'),
fontSize: 12, color: Colors.grey[600]), Text(
), _getFullAccountType(account.accountType),
], style: TextStyle(
), fontSize: 12, color: Colors.grey[600]),
onTap: () {
// Navigate to the amount screen, passing the selected User object directly.
// No Beneficiary object is created.
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => FundTransferSelfAmountScreen(
debitAccountNo: debitAccountNo,
creditAccount: account, // Pass the User object
remitterName: remitterName,
), ),
), ],
); ),
}, onTap: () {
// Navigate to the amount screen, passing the selected User object directly.
// No Beneficiary object is created.
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
FundTransferSelfAmountScreen(
debitAccountNo: debitAccountNo,
creditAccount: account, // Pass the User object
remitterName: remitterName,
),
),
);
},
),
); );
}, },
), ),