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

View File

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

View File

@@ -104,7 +104,9 @@ class _CustomerInfoScreenState extends State<CustomerInfoScreen> {
width: double.infinity,
child: CupertinoSlidingSegmentedControl<int>(
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) {
if (newValue != null) {
setState(() {
@@ -114,12 +116,16 @@ class _CustomerInfoScreenState extends State<CustomerInfoScreen> {
},
children: {
0: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
child: Text(AppLocalizations.of(context).personaldetails),
padding: const EdgeInsets.symmetric(
horizontal: 20, vertical: 10),
child: Text(
AppLocalizations.of(context).personaldetails),
),
1: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
child: Text(AppLocalizations.of(context).kycdetails),
padding: const EdgeInsets.symmetric(
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_state.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/enquiry/screens/enquiry_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) {
final theme = Theme.of(context);
final bool isCardVisible = _visibilityMap[user.accountNo] ?? false;
@@ -355,10 +352,8 @@ class _DashboardScreenState extends State<DashboardScreen>
selectedAccountIndex < authState.users.length) {
mobileNumberToPass =
authState.users[selectedAccountIndex].mobileNo ?? '';
customerNo =
authState.users[selectedAccountIndex].cifNumber ?? '';
customerName =
authState.users[selectedAccountIndex].name ?? '';
customerNo = authState.users[selectedAccountIndex].cifNumber ?? '';
customerName = authState.users[selectedAccountIndex].name ?? '';
}
}
return BlocListener<AuthCubit, AuthState>(
@@ -416,8 +411,6 @@ class _DashboardScreenState extends State<DashboardScreen>
child: InkWell(
borderRadius: BorderRadius.circular(20),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
@@ -454,8 +447,7 @@ class _DashboardScreenState extends State<DashboardScreen>
// firsttime load
if (!_txInitialized) {
_txInitialized = true;
WidgetsBinding.instance.addPostFrameCallback((_) {
});
WidgetsBinding.instance.addPostFrameCallback((_) {});
}
_pageController ??= PageController(
initialPage: selectedAccountIndex,
@@ -489,11 +481,11 @@ class _DashboardScreenState extends State<DashboardScreen>
child: PageView.builder(
clipBehavior: Clip.none,
controller: _pageController,
itemCount: users.length, // Keep this to show adjacent cards
itemCount:
users.length, // Keep this to show adjacent cards
onPageChanged: (int newIndex) async {
if (newIndex == selectedAccountIndex)
return;
if (newIndex == selectedAccountIndex) return;
// Hide the balance of the old card when scrolling away
final oldAccountNo =
@@ -508,10 +500,8 @@ class _DashboardScreenState extends State<DashboardScreen>
},
itemBuilder: (context, index) {
final user = users[index];
final isSelected =
index == selectedAccountIndex;
return _buildAccountCard(
user, isSelected);
final isSelected = index == selectedAccountIndex;
return _buildAccountCard(user, isSelected);
},
),
),
@@ -524,7 +514,8 @@ class _DashboardScreenState extends State<DashboardScreen>
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AllAccountsScreen(users: users),
builder: (context) =>
AllAccountsScreen(users: users),
),
);
},
@@ -625,8 +616,8 @@ class _DashboardScreenState extends State<DashboardScreen>
selectedIndex: selectedAccountIndex,
)));
}),
_buildQuickLink(Icons.location_pin, AppLocalizations.of(context).branchlocator,
() {
_buildQuickLink(Icons.location_pin,
AppLocalizations.of(context).branchlocator, () {
Navigator.push(
context,
MaterialPageRoute(
@@ -658,8 +649,7 @@ class _DashboardScreenState extends State<DashboardScreen>
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
ProfileScreen(
builder: (context) => ProfileScreen(
mobileNumber: mobileNumberToPass,
customerNo: customerNo,
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(
IconData icon,
String label,

View File

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

View File

@@ -45,11 +45,9 @@ class _ChangeLimitOTPScreenState extends State<ChangeLimitOTPScreen> {
double.parse(widget.newLimit),
);
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
content: Text("Limit has been Changed"),
)
);
));
// Navigate back to profile or login
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) {
return Scaffold(
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(
children: [