UI #1
This commit is contained in:
@@ -319,11 +319,9 @@ class _NavigationScaffoldState extends State<NavigationScaffold> {
|
|||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is Authenticated) {
|
if (state is Authenticated) {
|
||||||
if (state.users.isNotEmpty) {
|
if (state.users.isNotEmpty) {
|
||||||
final user = state.users.first;
|
|
||||||
return AccountStatementScreen(
|
return AccountStatementScreen(
|
||||||
accountNo: user.accountNo ?? '',
|
users: state.users,
|
||||||
balance: user.availableBalance ?? '0.00',
|
selectedIndex: 0,
|
||||||
accountType: user.accountType ?? '',
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return const Center(child: Text("No accounts found."));
|
return const Center(child: Text("No accounts found."));
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ Dio _createDioClient() {
|
|||||||
final dio = Dio(
|
final dio = Dio(
|
||||||
BaseOptions(
|
BaseOptions(
|
||||||
baseUrl:
|
baseUrl:
|
||||||
'http://lb-test-mobile-banking-app-192209417.ap-south-1.elb.amazonaws.com:8080', //test
|
// 'http://lb-test-mobile-banking-app-192209417.ap-south-1.elb.amazonaws.com:8080', //test
|
||||||
//'http://lb-kccb-mobile-banking-app-848675342.ap-south-1.elb.amazonaws.com', //prod
|
//'http://lb-kccb-mobile-banking-app-848675342.ap-south-1.elb.amazonaws.com', //prod
|
||||||
//'https://kccbmbnk.net', //prod small
|
'https://kccbmbnk.net', //prod small
|
||||||
connectTimeout: const Duration(seconds: 60),
|
connectTimeout: const Duration(seconds: 60),
|
||||||
receiveTimeout: const Duration(seconds: 60),
|
receiveTimeout: const Duration(seconds: 60),
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@@ -17,99 +17,279 @@ class AccountInfoScreen extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _AccountInfoScreen extends State<AccountInfoScreen> {
|
class _AccountInfoScreen extends State<AccountInfoScreen> {
|
||||||
|
|
||||||
late User selectedUser;
|
late User selectedUser;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
selectedUser = widget.users[widget.selectedIndex];
|
selectedUser = widget.users[widget.selectedIndex];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getFullAccountType(String? accountType) {
|
||||||
|
if (accountType == null || accountType.isEmpty) return 'N/A';
|
||||||
|
// Convert to title case
|
||||||
|
switch (accountType.toLowerCase()) {
|
||||||
|
case 'sa':
|
||||||
|
return AppLocalizations.of(context).savingsAccount;
|
||||||
|
case 'sb':
|
||||||
|
return AppLocalizations.of(context).savingsAccount;
|
||||||
|
case 'ln':
|
||||||
|
return AppLocalizations.of(context).loanAccount;
|
||||||
|
case 'td':
|
||||||
|
return AppLocalizations.of(context).termDeposit;
|
||||||
|
case 'rd':
|
||||||
|
return AppLocalizations.of(context).recurringDeposit;
|
||||||
|
case 'ca':
|
||||||
|
return "Current Account";
|
||||||
|
default:
|
||||||
|
return AppLocalizations.of(context).unknownAccount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
final users = widget.users;
|
final users = widget.users;
|
||||||
|
|
||||||
int selectedIndex = widget.selectedIndex;
|
int selectedIndex = widget.selectedIndex;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
|
||||||
title: Text(AppLocalizations.of(context)
|
title: Text(AppLocalizations.of(context)
|
||||||
|
|
||||||
.accountInfo
|
.accountInfo
|
||||||
|
|
||||||
.replaceFirst(RegExp('\n'), '')),
|
.replaceFirst(RegExp('\n'), '')),
|
||||||
|
|
||||||
),
|
),
|
||||||
|
|
||||||
body: Stack(
|
body: Stack(
|
||||||
|
|
||||||
children: [
|
children: [
|
||||||
ListView(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
AppLocalizations.of(context).accountNumber,
|
|
||||||
style:
|
|
||||||
const TextStyle(fontWeight: FontWeight.w500, fontSize: 14),
|
|
||||||
),
|
|
||||||
|
|
||||||
DropdownButton<User>(
|
Padding(
|
||||||
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(
|
padding: const EdgeInsets.all(8.0),
|
||||||
title: AppLocalizations.of(context).customerNumber,
|
|
||||||
value: selectedUser.cifNumber ?? 'N/A',
|
child: Column(
|
||||||
),
|
|
||||||
InfoRow(
|
children: [
|
||||||
title: AppLocalizations.of(context).productName,
|
|
||||||
value: selectedUser.productType ?? 'N/A',
|
Card(
|
||||||
),
|
|
||||||
// InfoRow(title: 'Account Opening Date', value: users[selectedIndex].accountOpeningDate ?? 'N/A'),
|
elevation: 4,
|
||||||
InfoRow(
|
|
||||||
title: AppLocalizations.of(context).accountStatus,
|
margin: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
value: 'OPEN',
|
|
||||||
),
|
child: Padding(
|
||||||
InfoRow(
|
|
||||||
title: AppLocalizations.of(context).availableBalance,
|
padding: const EdgeInsets.all(16.0),
|
||||||
value: selectedUser.availableBalance ?? 'N/A',
|
|
||||||
),
|
child: Column(
|
||||||
InfoRow(
|
|
||||||
title: AppLocalizations.of(context).currentBalance,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
value: selectedUser.currentBalance ?? 'N/A',
|
|
||||||
),
|
children: [
|
||||||
|
|
||||||
|
Text(
|
||||||
|
|
||||||
|
AppLocalizations.of(context).accountNumber,
|
||||||
|
|
||||||
|
style: const TextStyle(
|
||||||
|
|
||||||
|
fontWeight: FontWeight.bold, fontSize: 18),
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
|
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(),
|
||||||
|
|
||||||
|
style: const TextStyle(
|
||||||
|
|
||||||
|
fontSize: 20, fontWeight: FontWeight.bold),
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
}).toList(),
|
||||||
|
|
||||||
|
isExpanded: true,
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
users[selectedIndex].approvedAmount != null
|
|
||||||
? InfoRow(
|
|
||||||
title: AppLocalizations.of(context).approvedAmount,
|
|
||||||
value: selectedUser.approvedAmount ?? 'N/A',
|
|
||||||
)
|
|
||||||
: const SizedBox.shrink(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
IgnorePointer(
|
|
||||||
child: Center(
|
|
||||||
child: Opacity(
|
|
||||||
opacity: 0.07, // Reduced opacity
|
|
||||||
child: ClipOval(
|
|
||||||
child: Image.asset(
|
|
||||||
'assets/images/logo.png',
|
|
||||||
width: 200, // Adjust size as needed
|
|
||||||
height: 200, // Adjust size as needed
|
|
||||||
),
|
),
|
||||||
|
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
Expanded(
|
||||||
|
|
||||||
|
child: Card(
|
||||||
|
|
||||||
|
elevation: 4,
|
||||||
|
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
|
|
||||||
|
child: Padding(
|
||||||
|
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
|
||||||
|
child: ListView(
|
||||||
|
|
||||||
|
children: [
|
||||||
|
|
||||||
|
InfoRow(
|
||||||
|
|
||||||
|
title: AppLocalizations.of(context).customerNumber,
|
||||||
|
|
||||||
|
value: selectedUser.cifNumber ?? 'N/A',
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
|
InfoRow(
|
||||||
|
|
||||||
|
title: AppLocalizations.of(context).accountType,
|
||||||
|
|
||||||
|
value: getFullAccountType(selectedUser.accountType),
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
|
InfoRow(
|
||||||
|
|
||||||
|
title: AppLocalizations.of(context).productName,
|
||||||
|
|
||||||
|
value: selectedUser.productType ?? 'N/A',
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
|
InfoRow(
|
||||||
|
|
||||||
|
title: AppLocalizations.of(context).accountStatus,
|
||||||
|
|
||||||
|
value: 'OPEN',
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
|
InfoRow(
|
||||||
|
|
||||||
|
title:
|
||||||
|
|
||||||
|
AppLocalizations.of(context).availableBalance,
|
||||||
|
|
||||||
|
value: selectedUser.availableBalance ?? 'N/A',
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
|
InfoRow(
|
||||||
|
|
||||||
|
title: AppLocalizations.of(context).currentBalance,
|
||||||
|
|
||||||
|
value: selectedUser.currentBalance ?? 'N/A',
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
|
if (users[selectedIndex].approvedAmount != null)
|
||||||
|
|
||||||
|
InfoRow(
|
||||||
|
|
||||||
|
title:
|
||||||
|
|
||||||
|
AppLocalizations.of(context).approvedAmount,
|
||||||
|
|
||||||
|
value: selectedUser.approvedAmount ?? 'N/A',
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
),
|
),
|
||||||
|
|
||||||
),
|
),
|
||||||
|
|
||||||
|
IgnorePointer(
|
||||||
|
|
||||||
|
child: Center(
|
||||||
|
|
||||||
|
child: Opacity(
|
||||||
|
|
||||||
|
opacity: 0.07, // Reduced opacity
|
||||||
|
|
||||||
|
child: ClipOval(
|
||||||
|
|
||||||
|
child: Image.asset(
|
||||||
|
|
||||||
|
'assets/images/logo.png',
|
||||||
|
|
||||||
|
width: 200, // Adjust size as needed
|
||||||
|
|
||||||
|
height: 200, // Adjust size as needed
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
),
|
),
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class InfoRow extends StatelessWidget {
|
class InfoRow extends StatelessWidget {
|
||||||
@@ -130,15 +310,18 @@ class InfoRow extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 15,
|
fontSize: 18,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.bold,
|
||||||
color: theme.colorScheme.onSurfaceVariant,
|
color: theme.colorScheme.onSurfaceVariant,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 3),
|
const SizedBox(height: 3),
|
||||||
Text(
|
Text(
|
||||||
value,
|
value,
|
||||||
style: TextStyle(fontSize: 16, color: theme.colorScheme.onSurface),
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: theme.colorScheme.onSurface),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -14,15 +14,16 @@ import 'package:device_info_plus/device_info_plus.dart';
|
|||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
|
import 'package:kmobile/data/models/user.dart';
|
||||||
|
|
||||||
class AccountStatementScreen extends StatefulWidget {
|
class AccountStatementScreen extends StatefulWidget {
|
||||||
final String accountNo;
|
final List<User> users;
|
||||||
final String balance;
|
final int selectedIndex;
|
||||||
final String accountType;
|
|
||||||
const AccountStatementScreen({
|
const AccountStatementScreen({
|
||||||
super.key,
|
super.key,
|
||||||
required this.accountNo,
|
required this.users,
|
||||||
required this.balance,
|
required this.selectedIndex,
|
||||||
required this.accountType,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -30,6 +31,7 @@ class AccountStatementScreen extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _AccountStatementScreen extends State<AccountStatementScreen> {
|
class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||||
|
late User selectedUser;
|
||||||
DateTime? fromDate;
|
DateTime? fromDate;
|
||||||
DateTime? toDate;
|
DateTime? toDate;
|
||||||
bool _txLoading = true;
|
bool _txLoading = true;
|
||||||
@@ -41,6 +43,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
selectedUser = widget.users[widget.selectedIndex];
|
||||||
_loadTransactions();
|
_loadTransactions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +55,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
try {
|
try {
|
||||||
final repo = getIt<TransactionRepository>();
|
final repo = getIt<TransactionRepository>();
|
||||||
final txs = await repo.fetchTransactions(
|
final txs = await repo.fetchTransactions(
|
||||||
widget.accountNo,
|
selectedUser.accountNo?? '',
|
||||||
fromDate: fromDate,
|
fromDate: fromDate,
|
||||||
toDate: toDate,
|
toDate: toDate,
|
||||||
);
|
);
|
||||||
@@ -143,18 +146,27 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Text(
|
||||||
children: [
|
AppLocalizations.of(context).accountNumber,
|
||||||
Text(
|
style: const TextStyle(
|
||||||
"${AppLocalizations.of(context).accountNumber}: ",
|
fontWeight: FontWeight.w500, fontSize: 14),
|
||||||
style: const TextStyle(
|
),
|
||||||
fontSize: 17,
|
DropdownButton<User>(
|
||||||
fontWeight: FontWeight.bold,
|
value: selectedUser,
|
||||||
),
|
onChanged: (User? newUser) {
|
||||||
),
|
if (newUser != null) {
|
||||||
Text(widget.accountNo,
|
setState(() {
|
||||||
style: const TextStyle(fontSize: 17)),
|
selectedUser = newUser;
|
||||||
],
|
});
|
||||||
|
_loadTransactions();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
items: widget.users.map((user) {
|
||||||
|
return DropdownMenuItem<User>(
|
||||||
|
value: user,
|
||||||
|
child: Text(user.accountNo.toString()),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
Row(
|
Row(
|
||||||
@@ -165,7 +177,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
fontSize: 17,
|
fontSize: 17,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(' ₹ ${widget.balance}',
|
Text(' ₹ ${selectedUser.availableBalance}',
|
||||||
style: const TextStyle(fontSize: 17)),
|
style: const TextStyle(fontSize: 17)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -298,9 +310,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
? Symbols.call_received
|
? Symbols.call_received
|
||||||
: Symbols.call_made,
|
: Symbols.call_made,
|
||||||
color: tx.type == 'CR'
|
color: tx.type == 'CR'
|
||||||
? Theme.of(context)
|
? const Color(0xFF10BB10)
|
||||||
.colorScheme
|
|
||||||
.secondary
|
|
||||||
: Theme.of(context).colorScheme.error,
|
: Theme.of(context).colorScheme.error,
|
||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
@@ -413,10 +423,10 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
pw.Row(
|
pw.Row(
|
||||||
mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
pw.Text('Account Number: ${widget.accountNo}',
|
pw.Text('Account Number: ${selectedUser.accountNo}',
|
||||||
style:
|
style:
|
||||||
pw.TextStyle(font: pw.Font.ttf(rubik), fontSize: 15)),
|
pw.TextStyle(font: pw.Font.ttf(rubik), fontSize: 15)),
|
||||||
pw.Text('Account Type: ${widget.accountType}',
|
pw.Text('Account Type: ${selectedUser.productType}',
|
||||||
style: pw.TextStyle(
|
style: pw.TextStyle(
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
font: pw.Font.ttf(rubik),
|
font: pw.Font.ttf(rubik),
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class TransactionDetailsScreen extends StatelessWidget {
|
|||||||
? Symbols.call_received
|
? Symbols.call_received
|
||||||
: Symbols.call_made,
|
: Symbols.call_made,
|
||||||
color: isCredit
|
color: isCredit
|
||||||
? Theme.of(context).colorScheme.secondary
|
? const Color(0xFF10BB10)
|
||||||
: Theme.of(context).colorScheme.error,
|
: Theme.of(context).colorScheme.error,
|
||||||
size: 28,
|
size: 28,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -675,13 +675,8 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
AccountStatementScreen(
|
AccountStatementScreen(
|
||||||
accountNo: users[selectedAccountIndex]
|
users: users,
|
||||||
.accountNo!,
|
selectedIndex: selectedAccountIndex,
|
||||||
balance: users[selectedAccountIndex]
|
|
||||||
.availableBalance!,
|
|
||||||
accountType:
|
|
||||||
users[selectedAccountIndex]
|
|
||||||
.accountType!,
|
|
||||||
)));
|
)));
|
||||||
}),
|
}),
|
||||||
_buildQuickLink(Icons.location_pin, "Branch Locator",
|
_buildQuickLink(Icons.location_pin, "Branch Locator",
|
||||||
@@ -722,6 +717,7 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
disable: true,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user