diff --git a/lib/features/accounts/screens/account_info_screen.dart b/lib/features/accounts/screens/account_info_screen.dart index 7f64de1..f8e2018 100644 --- a/lib/features/accounts/screens/account_info_screen.dart +++ b/lib/features/accounts/screens/account_info_screen.dart @@ -5,18 +5,28 @@ import 'package:material_symbols_icons/material_symbols_icons.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; class AccountInfoScreen extends StatefulWidget { - final User user; + final List users; + final int selectedIndex; - const AccountInfoScreen({super.key, required this.user}); + const AccountInfoScreen( + {super.key, required this.users, required this.selectedIndex}); @override State createState() => _AccountInfoScreen(); } class _AccountInfoScreen extends State { + late User selectedUser; + @override + void initState() { + super.initState(); + selectedUser = widget.users[widget.selectedIndex]; + } + @override Widget build(BuildContext context) { - final user = widget.user; + final users = widget.users; + int selectedIndex = widget.selectedIndex; return Scaffold( appBar: AppBar( leading: IconButton( @@ -27,7 +37,8 @@ class _AccountInfoScreen extends State { ), title: Text( AppLocalizations.of(context).accountInfo, - style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500), + style: + const TextStyle(color: Colors.black, fontWeight: FontWeight.w500), ), centerTitle: false, actions: [ @@ -49,32 +60,58 @@ class _AccountInfoScreen extends State { body: ListView( padding: const EdgeInsets.all(16.0), children: [ - InfoRow( + Text( + AppLocalizations.of(context).accountNumber, + style: const TextStyle( + fontWeight: FontWeight.w500, + fontSize: 14, + ), + ), + + /// Dropdown to change account + DropdownButton( + value: selectedUser, + onChanged: (User? newUser) { + if (newUser != null) { + setState(() { + selectedUser = newUser; + }); + } + }, + items: widget.users.map((user) { + return DropdownMenuItem( + value: user, + child: Text(user.accountNo.toString()), + ); + }).toList(), + ), + + /*InfoRow( title: AppLocalizations.of(context).accountNumber, - value: user.accountNo ?? 'N/A'), + value: users[selectedIndex].accountNo ?? 'N/A'), // InfoRow(title: 'Nominee Customer No', value: user.nomineeCustomerNo), // InfoRow(title: 'SMS Service', value: user.smsService), - // InfoRow(title: 'Missed Call Service', value: user.missedCallService), + // InfoRow(title: 'Missed Call Service', value: user.missedCallService),*/ InfoRow( title: AppLocalizations.of(context).customerNumber, - value: user.cifNumber ?? 'N/A'), + value: selectedUser.cifNumber ?? 'N/A'), InfoRow( title: AppLocalizations.of(context).productName, - value: user.productType ?? 'N/A'), - // InfoRow(title: 'Account Opening Date', value: user.accountOpeningDate ?? 'N/A'), + value: selectedUser.productType ?? 'N/A'), + // InfoRow(title: 'Account Opening Date', value: users[selectedIndex].accountOpeningDate ?? 'N/A'), InfoRow( title: AppLocalizations.of(context).accountStatus, value: 'OPEN'), InfoRow( title: AppLocalizations.of(context).availableBalance, - value: user.availableBalance ?? 'N/A'), + value: selectedUser.availableBalance ?? 'N/A'), InfoRow( title: AppLocalizations.of(context).currentBalance, - value: user.currentBalance ?? 'N/A'), + value: selectedUser.currentBalance ?? 'N/A'), - user.approvedAmount != null + users[selectedIndex].approvedAmount != null ? InfoRow( title: AppLocalizations.of(context).approvedAmount, - value: user.approvedAmount ?? 'N/A') + value: selectedUser.approvedAmount ?? 'N/A') : const SizedBox.shrink(), ], ), diff --git a/lib/features/accounts/screens/account_statement_screen.dart b/lib/features/accounts/screens/account_statement_screen.dart index bc7d872..2a9400c 100644 --- a/lib/features/accounts/screens/account_statement_screen.dart +++ b/lib/features/accounts/screens/account_statement_screen.dart @@ -139,8 +139,17 @@ class _AccountStatementScreen extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + Row( + children: [ + Text("${AppLocalizations.of(context).accountNumber}: ", + style: const TextStyle( + fontSize: 19, fontWeight: FontWeight.bold)), + Text(widget.accountNo, style: const TextStyle(fontSize: 17)), + ], + ), + const SizedBox(height: 15), Text(AppLocalizations.of(context).filters, - style: TextStyle(fontSize: 17)), + style: const TextStyle(fontSize: 17)), const SizedBox(height: 15), Row( children: [ diff --git a/lib/features/dashboard/screens/dashboard_screen.dart b/lib/features/dashboard/screens/dashboard_screen.dart index 9fc2413..7d95674 100644 --- a/lib/features/dashboard/screens/dashboard_screen.dart +++ b/lib/features/dashboard/screens/dashboard_screen.dart @@ -442,7 +442,8 @@ class _DashboardScreenState extends State { context, MaterialPageRoute( builder: (context) => AccountInfoScreen( - user: users[selectedAccountIndex]))); + users: users, + selectedIndex: selectedAccountIndex))); }), _buildQuickLink(Symbols.receipt_long, AppLocalizations.of(context).accountStatement, () {