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';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
class AccountInfoScreen extends StatefulWidget {
|
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
|
@override
|
||||||
State<AccountInfoScreen> createState() => _AccountInfoScreen();
|
State<AccountInfoScreen> createState() => _AccountInfoScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AccountInfoScreen extends State<AccountInfoScreen> {
|
class _AccountInfoScreen extends State<AccountInfoScreen> {
|
||||||
|
late User selectedUser;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
selectedUser = widget.users[widget.selectedIndex];
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final user = widget.user;
|
final users = widget.users;
|
||||||
|
int selectedIndex = widget.selectedIndex;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
@@ -27,7 +37,8 @@ class _AccountInfoScreen extends State<AccountInfoScreen> {
|
|||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context).accountInfo,
|
AppLocalizations.of(context).accountInfo,
|
||||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
style:
|
||||||
|
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
actions: [
|
actions: [
|
||||||
@@ -49,32 +60,58 @@ class _AccountInfoScreen extends State<AccountInfoScreen> {
|
|||||||
body: ListView(
|
body: ListView(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
children: [
|
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,
|
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: 'Nominee Customer No', value: user.nomineeCustomerNo),
|
||||||
// InfoRow(title: 'SMS Service', value: user.smsService),
|
// InfoRow(title: 'SMS Service', value: user.smsService),
|
||||||
// InfoRow(title: 'Missed Call Service', value: user.missedCallService),
|
// InfoRow(title: 'Missed Call Service', value: user.missedCallService),*/
|
||||||
InfoRow(
|
InfoRow(
|
||||||
title: AppLocalizations.of(context).customerNumber,
|
title: AppLocalizations.of(context).customerNumber,
|
||||||
value: user.cifNumber ?? 'N/A'),
|
value: selectedUser.cifNumber ?? 'N/A'),
|
||||||
InfoRow(
|
InfoRow(
|
||||||
title: AppLocalizations.of(context).productName,
|
title: AppLocalizations.of(context).productName,
|
||||||
value: user.productType ?? 'N/A'),
|
value: selectedUser.productType ?? 'N/A'),
|
||||||
// InfoRow(title: 'Account Opening Date', value: user.accountOpeningDate ?? 'N/A'),
|
// InfoRow(title: 'Account Opening Date', value: users[selectedIndex].accountOpeningDate ?? 'N/A'),
|
||||||
InfoRow(
|
InfoRow(
|
||||||
title: AppLocalizations.of(context).accountStatus, value: 'OPEN'),
|
title: AppLocalizations.of(context).accountStatus, value: 'OPEN'),
|
||||||
InfoRow(
|
InfoRow(
|
||||||
title: AppLocalizations.of(context).availableBalance,
|
title: AppLocalizations.of(context).availableBalance,
|
||||||
value: user.availableBalance ?? 'N/A'),
|
value: selectedUser.availableBalance ?? 'N/A'),
|
||||||
InfoRow(
|
InfoRow(
|
||||||
title: AppLocalizations.of(context).currentBalance,
|
title: AppLocalizations.of(context).currentBalance,
|
||||||
value: user.currentBalance ?? 'N/A'),
|
value: selectedUser.currentBalance ?? 'N/A'),
|
||||||
|
|
||||||
user.approvedAmount != null
|
users[selectedIndex].approvedAmount != null
|
||||||
? InfoRow(
|
? InfoRow(
|
||||||
title: AppLocalizations.of(context).approvedAmount,
|
title: AppLocalizations.of(context).approvedAmount,
|
||||||
value: user.approvedAmount ?? 'N/A')
|
value: selectedUser.approvedAmount ?? 'N/A')
|
||||||
: const SizedBox.shrink(),
|
: const SizedBox.shrink(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@@ -139,8 +139,17 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
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,
|
Text(AppLocalizations.of(context).filters,
|
||||||
style: TextStyle(fontSize: 17)),
|
style: const TextStyle(fontSize: 17)),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
@@ -442,7 +442,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => AccountInfoScreen(
|
builder: (context) => AccountInfoScreen(
|
||||||
user: users[selectedAccountIndex])));
|
users: users,
|
||||||
|
selectedIndex: selectedAccountIndex)));
|
||||||
}),
|
}),
|
||||||
_buildQuickLink(Symbols.receipt_long,
|
_buildQuickLink(Symbols.receipt_long,
|
||||||
AppLocalizations.of(context).accountStatement, () {
|
AppLocalizations.of(context).accountStatement, () {
|
||||||
|
Reference in New Issue
Block a user