Code Formatting

This commit is contained in:
2025-12-05 16:02:49 +05:30
parent aef82237ac
commit 72a2c56392
10 changed files with 962 additions and 985 deletions

View File

@@ -480,8 +480,8 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
); );
// --- 1. LOAD ASSETS --- // --- 1. LOAD ASSETS ---
final logoImage = final logoImage = pw.MemoryImage(
pw.MemoryImage((await rootBundle.load('assets/images/logo.png')).buffer.asUint8List()); (await rootBundle.load('assets/images/logo.png')).buffer.asUint8List());
final timesFont = await rootBundle.load("assets/fonts/Rubik-Regular.ttf"); final timesFont = await rootBundle.load("assets/fonts/Rubik-Regular.ttf");
final timesBoldFont = await rootBundle.load("assets/fonts/Rubik-Bold.ttf"); final timesBoldFont = await rootBundle.load("assets/fonts/Rubik-Bold.ttf");
final ttf = pw.Font.ttf(timesFont); final ttf = pw.Font.ttf(timesFont);
@@ -534,8 +534,8 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
tableBorderColor: tableBorderColor, tableBorderColor: tableBorderColor,
lightBgColor: lightBgColor, lightBgColor: lightBgColor,
), ),
_buildWarning(warningBgColor, warningBorderColor, debitColor, _buildWarning(
warningTextColor), warningBgColor, warningBorderColor, debitColor, warningTextColor),
_buildPeriodHeader( _buildPeriodHeader(
primaryColor: primaryColor, primaryColor: primaryColor,
fromDate: fromDate, fromDate: fromDate,
@@ -549,8 +549,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
tableBorderColor: tableBorderColor, tableBorderColor: tableBorderColor,
), ),
pw.SizedBox(height: 20), pw.SizedBox(height: 20),
pw.Text('END OF STATEMENT', pw.Text('END OF STATEMENT', style: const pw.TextStyle(fontSize: 12)),
style: const pw.TextStyle(fontSize: 12)),
], ],
), ),
); );
@@ -572,7 +571,8 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
final Uint8List pdfBytes = await pdf.save(); final Uint8List pdfBytes = await pdf.save();
final String timestamp = final String timestamp =
DateFormat("ddMMyyyy_HHmm").format(DateTime.now()); DateFormat("ddMMyyyy_HHmm").format(DateTime.now());
final String fileName = 'Statement_${selectedUser.accountNo}_$timestamp.pdf'; final String fileName =
'Statement_${selectedUser.accountNo}_$timestamp.pdf';
String? filePath; String? filePath;
@@ -628,7 +628,8 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
'PDF Download Failed', 'PDF Download Failed',
'Error saving PDF: $e', 'Error saving PDF: $e',
const NotificationDetails( const NotificationDetails(
android: AndroidNotificationDetails('download_channel', 'Download Notifications', android: AndroidNotificationDetails(
'download_channel', 'Download Notifications',
channelDescription: 'Notifications for PDF downloads', channelDescription: 'Notifications for PDF downloads',
importance: Importance.high, importance: Importance.high,
priority: Priority.high, priority: Priority.high,
@@ -730,14 +731,18 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
children: [ children: [
pw.TableRow( pw.TableRow(
children: [ children: [
_buildDetailCell('Customer Name', customerName, cellPadding, lightGreyColor), _buildDetailCell(
_buildDetailCell('CIF Number', cifNumber, cellPadding, lightGreyColor), 'Customer Name', customerName, cellPadding, lightGreyColor),
_buildDetailCell(
'CIF Number', cifNumber, cellPadding, lightGreyColor),
], ],
), ),
pw.TableRow( pw.TableRow(
children: [ children: [
_buildDetailCell('Account Number', accountNo, cellPadding, lightGreyColor), _buildDetailCell(
_buildDetailCell('Branch Code', branchCode, cellPadding, lightGreyColor), 'Account Number', accountNo, cellPadding, lightGreyColor),
_buildDetailCell(
'Branch Code', branchCode, cellPadding, lightGreyColor),
], ],
), ),
pw.TableRow( pw.TableRow(
@@ -755,7 +760,8 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
pw.SizedBox(height: 2), pw.SizedBox(height: 2),
pw.Text( pw.Text(
address, address,
style: pw.TextStyle(fontSize: 11, fontWeight: pw.FontWeight.bold), style: pw.TextStyle(
fontSize: 11, fontWeight: pw.FontWeight.bold),
), ),
], ],
), ),
@@ -769,7 +775,8 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
} }
pw.Widget _buildDetailCell(String label, String value, pw.EdgeInsets padding, pw.Widget _buildDetailCell(String label, String value, pw.EdgeInsets padding,
PdfColor lightGreyColor, {bool vertical = false}) { PdfColor lightGreyColor,
{bool vertical = false}) {
final children = [ final children = [
pw.Text( pw.Text(
label, label,
@@ -812,9 +819,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
child: pw.RichText( child: pw.RichText(
text: pw.TextSpan( text: pw.TextSpan(
style: pw.TextStyle( style: pw.TextStyle(
fontSize: 10, fontSize: 10, color: warningTextColor, lineSpacing: 1.5),
color: warningTextColor,
lineSpacing: 1.5),
children: [ children: [
pw.TextSpan( pw.TextSpan(
text: 'NEVER SHARE ', text: 'NEVER SHARE ',
@@ -861,8 +866,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
style: pw.TextStyle(fontWeight: pw.FontWeight.bold)), style: pw.TextStyle(fontWeight: pw.FontWeight.bold)),
const pw.TextSpan(text: ' to '), const pw.TextSpan(text: ' to '),
pw.TextSpan( pw.TextSpan(
text: to, text: to, style: pw.TextStyle(fontWeight: pw.FontWeight.bold)),
style: pw.TextStyle(fontWeight: pw.FontWeight.bold)),
], ],
), ),
), ),
@@ -974,7 +978,6 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
); );
} }
pw.Widget _buildLastPage() { pw.Widget _buildLastPage() {
return pw.Container( return pw.Container(
padding: const pw.EdgeInsets.all(20), padding: const pw.EdgeInsets.all(20),
@@ -1014,8 +1017,8 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
), ),
); );
} }
List<pw.Widget> _buildInfoPoints(
PdfColor primaryColor, List<String> points) { List<pw.Widget> _buildInfoPoints(PdfColor primaryColor, List<String> points) {
return points.map((point) { return points.map((point) {
return pw.Padding( return pw.Padding(
padding: const pw.EdgeInsets.only(bottom: 10), padding: const pw.EdgeInsets.only(bottom: 10),
@@ -1042,7 +1045,9 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
), ),
); );
}).toList(); }).toList();
} Widget buildDateBox(String label, DateTime? date) { }
Widget buildDateBox(String label, DateTime? date) {
return Container( return Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16), padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16),
decoration: BoxDecoration( decoration: BoxDecoration(

View File

@@ -56,8 +56,8 @@ class _AllAccountsScreenState extends State<AllAccountsScreen> {
itemBuilder: (context, index) { itemBuilder: (context, index) {
final user = widget.users[index]; final user = widget.users[index];
return Padding( return Padding(
padding: padding: const EdgeInsets.symmetric(
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), horizontal: 16.0, vertical: 8.0),
child: _buildAccountCard(user), child: _buildAccountCard(user),
); );
}, },

View File

@@ -104,7 +104,9 @@ class _CustomerInfoScreenState extends State<CustomerInfoScreen> {
width: double.infinity, width: double.infinity,
child: CupertinoSlidingSegmentedControl<int>( child: CupertinoSlidingSegmentedControl<int>(
groupValue: _selectedCard, groupValue: _selectedCard,
thumbColor: Theme.of(context).colorScheme.onPrimary, // Set selected switch color to theme primary color thumbColor: Theme.of(context)
.colorScheme
.onPrimary, // Set selected switch color to theme primary color
onValueChanged: (int? newValue) { onValueChanged: (int? newValue) {
if (newValue != null) { if (newValue != null) {
setState(() { setState(() {
@@ -114,12 +116,16 @@ class _CustomerInfoScreenState extends State<CustomerInfoScreen> {
}, },
children: { children: {
0: Padding( 0: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), padding: const EdgeInsets.symmetric(
child: Text(AppLocalizations.of(context).personaldetails), horizontal: 20, vertical: 10),
child: Text(
AppLocalizations.of(context).personaldetails),
), ),
1: Padding( 1: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), padding: const EdgeInsets.symmetric(
child: Text(AppLocalizations.of(context).kycdetails), horizontal: 20, vertical: 10),
child:
Text(AppLocalizations.of(context).kycdetails),
), ),
}, },
), ),

View File

@@ -9,7 +9,6 @@ import 'package:kmobile/features/accounts/screens/all_accounts_screen.dart';
import 'package:kmobile/features/auth/controllers/auth_cubit.dart'; import 'package:kmobile/features/auth/controllers/auth_cubit.dart';
import 'package:kmobile/features/auth/controllers/auth_state.dart'; import 'package:kmobile/features/auth/controllers/auth_state.dart';
import 'package:kmobile/features/customer_info/screens/customer_info_screen.dart'; import 'package:kmobile/features/customer_info/screens/customer_info_screen.dart';
import 'package:kmobile/features/cheque/screens/cheque_management_screen.dart';
import 'package:kmobile/features/beneficiaries/screens/manage_beneficiaries_screen.dart'; import 'package:kmobile/features/beneficiaries/screens/manage_beneficiaries_screen.dart';
import 'package:kmobile/features/enquiry/screens/enquiry_screen.dart'; import 'package:kmobile/features/enquiry/screens/enquiry_screen.dart';
import 'package:kmobile/features/fund_transfer/screens/fund_transfer_screen.dart'; import 'package:kmobile/features/fund_transfer/screens/fund_transfer_screen.dart';
@@ -65,8 +64,6 @@ class _DashboardScreenState extends State<DashboardScreen>
}); });
} }
Widget _buildAccountCard(User user, bool isSelected) { Widget _buildAccountCard(User user, bool isSelected) {
final theme = Theme.of(context); final theme = Theme.of(context);
final bool isCardVisible = _visibilityMap[user.accountNo] ?? false; final bool isCardVisible = _visibilityMap[user.accountNo] ?? false;
@@ -355,10 +352,8 @@ class _DashboardScreenState extends State<DashboardScreen>
selectedAccountIndex < authState.users.length) { selectedAccountIndex < authState.users.length) {
mobileNumberToPass = mobileNumberToPass =
authState.users[selectedAccountIndex].mobileNo ?? ''; authState.users[selectedAccountIndex].mobileNo ?? '';
customerNo = customerNo = authState.users[selectedAccountIndex].cifNumber ?? '';
authState.users[selectedAccountIndex].cifNumber ?? ''; customerName = authState.users[selectedAccountIndex].name ?? '';
customerName =
authState.users[selectedAccountIndex].name ?? '';
} }
} }
return BlocListener<AuthCubit, AuthState>( return BlocListener<AuthCubit, AuthState>(
@@ -416,8 +411,6 @@ class _DashboardScreenState extends State<DashboardScreen>
child: InkWell( child: InkWell(
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
@@ -454,8 +447,7 @@ class _DashboardScreenState extends State<DashboardScreen>
// firsttime load // firsttime load
if (!_txInitialized) { if (!_txInitialized) {
_txInitialized = true; _txInitialized = true;
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {});
});
} }
_pageController ??= PageController( _pageController ??= PageController(
initialPage: selectedAccountIndex, initialPage: selectedAccountIndex,
@@ -489,11 +481,11 @@ class _DashboardScreenState extends State<DashboardScreen>
child: PageView.builder( child: PageView.builder(
clipBehavior: Clip.none, clipBehavior: Clip.none,
controller: _pageController, controller: _pageController,
itemCount: users.length, // Keep this to show adjacent cards itemCount:
users.length, // Keep this to show adjacent cards
onPageChanged: (int newIndex) async { onPageChanged: (int newIndex) async {
if (newIndex == selectedAccountIndex) if (newIndex == selectedAccountIndex) return;
return;
// Hide the balance of the old card when scrolling away // Hide the balance of the old card when scrolling away
final oldAccountNo = final oldAccountNo =
@@ -508,10 +500,8 @@ class _DashboardScreenState extends State<DashboardScreen>
}, },
itemBuilder: (context, index) { itemBuilder: (context, index) {
final user = users[index]; final user = users[index];
final isSelected = final isSelected = index == selectedAccountIndex;
index == selectedAccountIndex; return _buildAccountCard(user, isSelected);
return _buildAccountCard(
user, isSelected);
}, },
), ),
), ),
@@ -524,7 +514,8 @@ class _DashboardScreenState extends State<DashboardScreen>
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => AllAccountsScreen(users: users), builder: (context) =>
AllAccountsScreen(users: users),
), ),
); );
}, },
@@ -625,8 +616,8 @@ class _DashboardScreenState extends State<DashboardScreen>
selectedIndex: selectedAccountIndex, selectedIndex: selectedAccountIndex,
))); )));
}), }),
_buildQuickLink(Icons.location_pin, AppLocalizations.of(context).branchlocator, _buildQuickLink(Icons.location_pin,
() { AppLocalizations.of(context).branchlocator, () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
@@ -658,8 +649,7 @@ class _DashboardScreenState extends State<DashboardScreen>
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) => ProfileScreen(
ProfileScreen(
mobileNumber: mobileNumberToPass, mobileNumber: mobileNumberToPass,
customerNo: customerNo, customerNo: customerNo,
customerName: customerName), customerName: customerName),
@@ -684,32 +674,6 @@ class _DashboardScreenState extends State<DashboardScreen>
); );
} }
List<Widget> _buildTransactionShimmer() {
final theme = Theme.of(context);
return List.generate(3, (i) {
return ListTile(
leading: Shimmer.fromColors(
baseColor: Colors.grey[300]!,
highlightColor: Colors.grey[100]!,
child: CircleAvatar(
radius: 12, backgroundColor: theme.scaffoldBackgroundColor),
),
title: Shimmer.fromColors(
baseColor: Colors.grey[300]!,
highlightColor: Colors.grey[100]!,
child: Container(
height: 10, width: 100, color: theme.scaffoldBackgroundColor),
),
subtitle: Shimmer.fromColors(
baseColor: Colors.grey[300]!,
highlightColor: Colors.grey[100]!,
child: Container(
height: 8, width: 60, color: theme.scaffoldBackgroundColor),
),
);
});
}
Widget _buildQuickLink( Widget _buildQuickLink(
IconData icon, IconData icon,
String label, String label,

View File

@@ -43,7 +43,8 @@ class FundTransferScreen extends StatelessWidget {
child: FundTransferManagementTile( child: FundTransferManagementTile(
icon: Symbols.person, icon: Symbols.person,
label: "Self Pay", label: "Self Pay",
subtitle: AppLocalizations.of(context).ftselfpaysubtitle, subtitle:
AppLocalizations.of(context).ftselfpaysubtitle,
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
@@ -86,7 +87,8 @@ class FundTransferScreen extends StatelessWidget {
child: FundTransferManagementTile( child: FundTransferManagementTile(
icon: Symbols.output_circle, icon: Symbols.output_circle,
label: AppLocalizations.of(context).outsideBank, label: AppLocalizations.of(context).outsideBank,
subtitle: AppLocalizations.of(context).ftoutsidesubtitle, subtitle:
AppLocalizations.of(context).ftoutsidesubtitle,
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,

View File

@@ -45,11 +45,9 @@ class _ChangeLimitOTPScreenState extends State<ChangeLimitOTPScreen> {
double.parse(widget.newLimit), double.parse(widget.newLimit),
); );
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
const SnackBar(
content: Text("Limit has been Changed"), content: Text("Limit has been Changed"),
) ));
);
// Navigate back to profile or login // Navigate back to profile or login
Navigator.of(context).popUntil((route) => route.isFirst); Navigator.of(context).popUntil((route) => route.isFirst);

View File

@@ -406,7 +406,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
], ],
), ),
], ],
), ); ),
);
} }
} }

View File

@@ -62,7 +62,8 @@ class _ATMLocatorScreenState extends State<ATMLocatorScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(AppLocalizations.of(context).atmlocator), // Title for the app bar title: Text(
AppLocalizations.of(context).atmlocator), // Title for the app bar
), ),
body: Stack( body: Stack(
children: [ children: [