New Update with Account Number Dropdown in Account Info
This commit is contained in:
@@ -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<User> users;
|
||||
final int selectedIndex;
|
||||
|
||||
const AccountInfoScreen({super.key, required this.user});
|
||||
const AccountInfoScreen(
|
||||
{super.key, required this.users, required this.selectedIndex});
|
||||
|
||||
@override
|
||||
State<AccountInfoScreen> createState() => _AccountInfoScreen();
|
||||
}
|
||||
|
||||
class _AccountInfoScreen extends State<AccountInfoScreen> {
|
||||
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<AccountInfoScreen> {
|
||||
),
|
||||
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<AccountInfoScreen> {
|
||||
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<User>(
|
||||
value: selectedUser,
|
||||
onChanged: (User? newUser) {
|
||||
if (newUser != null) {
|
||||
setState(() {
|
||||
selectedUser = newUser;
|
||||
});
|
||||
}
|
||||
},
|
||||
items: widget.users.map((user) {
|
||||
return DropdownMenuItem<User>(
|
||||
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(),
|
||||
],
|
||||
),
|
||||
|
@@ -139,8 +139,17 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
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: [
|
||||
|
Reference in New Issue
Block a user