From f0d5233afcddef0cb62c3e225218d23ba5833698 Mon Sep 17 00:00:00 2001 From: asif Date: Thu, 20 Nov 2025 13:31:42 +0530 Subject: [PATCH] Beneficiary lists changed --- .../screens/manage_beneficiaries_screen.dart | 51 ++++---- .../fund_transfer_beneficiary_screen.dart | 109 +++++++++--------- .../fund_transfer_self_accounts_screen.dart | 69 ++++++----- 3 files changed, 120 insertions(+), 109 deletions(-) diff --git a/lib/features/beneficiaries/screens/manage_beneficiaries_screen.dart b/lib/features/beneficiaries/screens/manage_beneficiaries_screen.dart index 6f9fb63..0b82538 100644 --- a/lib/features/beneficiaries/screens/manage_beneficiaries_screen.dart +++ b/lib/features/beneficiaries/screens/manage_beneficiaries_screen.dart @@ -97,32 +97,35 @@ class _ManageBeneficiariesScreen extends State { itemCount: _filteredBeneficiaries.length, itemBuilder: (context, index) { final item = _filteredBeneficiaries[index]; - return ListTile( - leading: CircleAvatar( - radius: 24, - backgroundColor: Colors.transparent, - child: getBankLogo(item.bankName, context), - ), - title: Text(item.name), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(item.accountNo), - if (item.bankName != null && item.bankName!.isNotEmpty) - Text( - item.bankName!, - style: TextStyle(fontSize: 12, color: Colors.grey[600]), + return Card( + margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 6), + child: ListTile( + leading: CircleAvatar( + radius: 24, + backgroundColor: Colors.transparent, + child: getBankLogo(item.bankName, context), + ), + title: Text(item.name), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(item.accountNo), + if (item.bankName != null && item.bankName!.isNotEmpty) + 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), - ), - ); - }, ); }, ); diff --git a/lib/features/fund_transfer/screens/fund_transfer_beneficiary_screen.dart b/lib/features/fund_transfer/screens/fund_transfer_beneficiary_screen.dart index b81e56b..9ed0bc2 100644 --- a/lib/features/fund_transfer/screens/fund_transfer_beneficiary_screen.dart +++ b/lib/features/fund_transfer/screens/fund_transfer_beneficiary_screen.dart @@ -120,60 +120,63 @@ class _FundTransferBeneficiaryScreenState // By wrapping the ListTile in an Opacity widget, we can make it look // disabled while ensuring the onTap callback still works. - return Opacity( - opacity: isCoolingDown ? 0.5 : 1.0, - child: ListTile( - // REMOVED the 'enabled' property from here. - leading: CircleAvatar( - radius: 24, - backgroundColor: Colors.transparent, - child: getBankLogo(beneficiary.bankName, context), - ), - title: Text(beneficiary.name), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(beneficiary.accountNo), - if (beneficiary.bankName != null && - beneficiary.bankName!.isNotEmpty) - 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, + return Card( + margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 6), + child: Opacity( + opacity: isCoolingDown ? 0.5 : 1.0, + child: ListTile( + // REMOVED the 'enabled' property from here. + leading: CircleAvatar( + radius: 24, + backgroundColor: Colors.transparent, + child: getBankLogo(beneficiary.bankName, context), + ), + title: Text(beneficiary.name), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(beneficiary.accountNo), + if (beneficiary.bankName != null && + beneficiary.bankName!.isNotEmpty) + 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, + ), + ), + ); + } + }, + ), ), ); }, diff --git a/lib/features/fund_transfer/screens/fund_transfer_self_accounts_screen.dart b/lib/features/fund_transfer/screens/fund_transfer_self_accounts_screen.dart index 9c1b343..272ac20 100644 --- a/lib/features/fund_transfer/screens/fund_transfer_self_accounts_screen.dart +++ b/lib/features/fund_transfer/screens/fund_transfer_self_accounts_screen.dart @@ -55,39 +55,44 @@ class FundTransferSelfAccountsScreen extends StatelessWidget { itemCount: filteredAccounts.length, itemBuilder: (context, index) { final account = filteredAccounts[index]; - return ListTile( - leading: CircleAvatar( - radius: 24, - backgroundColor: Colors.transparent, - child: getBankLogo( - 'Kangra Central Co-operative Bank', context), - ), - title: Text(account.name ?? 'N/A'), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(account.accountNo ?? 'N/A'), - 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, + return Card( + margin: const EdgeInsets.symmetric( + horizontal: 12, vertical: 6), + child: ListTile( + leading: CircleAvatar( + radius: 24, + backgroundColor: Colors.transparent, + child: getBankLogo( + 'Kangra Central Co-operative Bank', context), + ), + title: Text(account.name ?? 'N/A'), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(account.accountNo ?? 'N/A'), + 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, + ), + ), + ); + }, + ), ); }, ),