UI #1
This commit is contained in:
@@ -14,15 +14,16 @@ import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
|
||||
import 'package:kmobile/data/models/user.dart';
|
||||
|
||||
class AccountStatementScreen extends StatefulWidget {
|
||||
final String accountNo;
|
||||
final String balance;
|
||||
final String accountType;
|
||||
final List<User> users;
|
||||
final int selectedIndex;
|
||||
|
||||
const AccountStatementScreen({
|
||||
super.key,
|
||||
required this.accountNo,
|
||||
required this.balance,
|
||||
required this.accountType,
|
||||
required this.users,
|
||||
required this.selectedIndex,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -30,6 +31,7 @@ class AccountStatementScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
late User selectedUser;
|
||||
DateTime? fromDate;
|
||||
DateTime? toDate;
|
||||
bool _txLoading = true;
|
||||
@@ -41,6 +43,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
selectedUser = widget.users[widget.selectedIndex];
|
||||
_loadTransactions();
|
||||
}
|
||||
|
||||
@@ -52,7 +55,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
try {
|
||||
final repo = getIt<TransactionRepository>();
|
||||
final txs = await repo.fetchTransactions(
|
||||
widget.accountNo,
|
||||
selectedUser.accountNo?? '',
|
||||
fromDate: fromDate,
|
||||
toDate: toDate,
|
||||
);
|
||||
@@ -143,18 +146,27 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"${AppLocalizations.of(context).accountNumber}: ",
|
||||
style: const TextStyle(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text(widget.accountNo,
|
||||
style: const TextStyle(fontSize: 17)),
|
||||
],
|
||||
Text(
|
||||
AppLocalizations.of(context).accountNumber,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w500, fontSize: 14),
|
||||
),
|
||||
DropdownButton<User>(
|
||||
value: selectedUser,
|
||||
onChanged: (User? newUser) {
|
||||
if (newUser != null) {
|
||||
setState(() {
|
||||
selectedUser = newUser;
|
||||
});
|
||||
_loadTransactions();
|
||||
}
|
||||
},
|
||||
items: widget.users.map((user) {
|
||||
return DropdownMenuItem<User>(
|
||||
value: user,
|
||||
child: Text(user.accountNo.toString()),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
Row(
|
||||
@@ -165,7 +177,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
fontSize: 17,
|
||||
),
|
||||
),
|
||||
Text(' ₹ ${widget.balance}',
|
||||
Text(' ₹ ${selectedUser.availableBalance}',
|
||||
style: const TextStyle(fontSize: 17)),
|
||||
],
|
||||
),
|
||||
@@ -298,9 +310,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
? Symbols.call_received
|
||||
: Symbols.call_made,
|
||||
color: tx.type == 'CR'
|
||||
? Theme.of(context)
|
||||
.colorScheme
|
||||
.secondary
|
||||
? const Color(0xFF10BB10)
|
||||
: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
title: Text(
|
||||
@@ -413,10 +423,10 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
pw.Row(
|
||||
mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
pw.Text('Account Number: ${widget.accountNo}',
|
||||
pw.Text('Account Number: ${selectedUser.accountNo}',
|
||||
style:
|
||||
pw.TextStyle(font: pw.Font.ttf(rubik), fontSize: 15)),
|
||||
pw.Text('Account Type: ${widget.accountType}',
|
||||
pw.Text('Account Type: ${selectedUser.productType}',
|
||||
style: pw.TextStyle(
|
||||
fontSize: 15,
|
||||
font: pw.Font.ttf(rubik),
|
||||
|
||||
Reference in New Issue
Block a user