formatted the whole codebase

This commit is contained in:
asif
2025-08-18 03:20:05 +05:30
parent e2a809d363
commit e6ea764785
58 changed files with 470 additions and 373 deletions

View File

@@ -45,7 +45,8 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
}
Widget _getBankLogo(String? bankName) {
if (bankName != null && bankName.toLowerCase().contains('state bank of india')) {
if (bankName != null &&
bankName.toLowerCase().contains('state bank of india')) {
return Image.asset(
'assets/images/sbi_logo.png',
width: 40,
@@ -69,8 +70,7 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
context: context,
builder: (ctx) => AlertDialog(
title: Text(AppLocalizations.of(context).invalidRtgs),
content: Text(
AppLocalizations.of(context).invalidRtgsPopUp),
content: Text(AppLocalizations.of(context).invalidRtgsPopUp),
actions: [
TextButton(
onPressed: () => Navigator.of(ctx).pop(),
@@ -120,18 +120,20 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
utr: neftResponse.utr,
);
completer.complete(paymentResponse);
} on DioException catch(e) {
} on DioException catch (e) {
print('dio exception');
print(e.toString());
final error = jsonDecode(e.response.toString())['error'];
var errorMessage =
{
"INCORRECT_TPIN" : AppLocalizations.of(context).correctTpin,
"INSUFFICIENT_FUNDS": AppLocalizations.of(context).insufficientFund
}[error] ?? AppLocalizations.of(context).somethingWentWrong;
final paymentResponse = PaymentResponse(
var errorMessage = {
"INCORRECT_TPIN":
AppLocalizations.of(context).correctTpin,
"INSUFFICIENT_FUNDS":
AppLocalizations.of(context).insufficientFund
}[error] ??
AppLocalizations.of(context).somethingWentWrong;
final paymentResponse = PaymentResponse(
isSuccess: false,
errorMessage: errorMessage,
);
@@ -141,7 +143,8 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
print(e.toString());
final paymentResponse = PaymentResponse(
isSuccess: false,
errorMessage: AppLocalizations.of(context).somethingWentWrong,
errorMessage:
AppLocalizations.of(context).somethingWentWrong,
);
completer.complete(paymentResponse);
}
@@ -181,14 +184,14 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
// } on DioException catch(e) {
// print('dio exception');
// print(e.toString());
// final error = jsonDecode(e.response.toString())['error'];
// var errorMessage =
// var errorMessage =
// {
// "INCORRECT_TPIN" : "Please Enter the correct TPIN",
// "INSUFFICIENT_FUNDS": "Your account does not have sufficient balance"
// }[error] ?? "Something Went Wrong";
// final paymentResponse = PaymentResponse(
// isSuccess: false,
// errorMessage: errorMessage,
@@ -236,19 +239,21 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
utr: rtgsResponse.utr,
);
completer.complete(paymentResponse);
} on DioException catch(e) {
} on DioException catch (e) {
print('dio exception');
print(e.toString());
final error = jsonDecode(e.response.toString())['error'];
var errorMessage =
{
"INCORRECT_TPIN" : AppLocalizations.of(context).correctTpin,
"INSUFFICIENT_FUNDS": AppLocalizations.of(context).insufficientFund
// ignore: use_build_context_synchronously
}[error] ?? AppLocalizations.of(context).somethingWentWrong;
final paymentResponse = PaymentResponse(
var errorMessage = {
"INCORRECT_TPIN":
AppLocalizations.of(context).correctTpin,
"INSUFFICIENT_FUNDS":
AppLocalizations.of(context).insufficientFund
// ignore: use_build_context_synchronously
}[error] ??
AppLocalizations.of(context).somethingWentWrong;
final paymentResponse = PaymentResponse(
isSuccess: false,
errorMessage: errorMessage,
);
@@ -258,7 +263,8 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
print(e.toString());
final paymentResponse = PaymentResponse(
isSuccess: false,
errorMessage: AppLocalizations.of(context).somethingWentWrong,
errorMessage:
AppLocalizations.of(context).somethingWentWrong,
);
completer.complete(paymentResponse);
}
@@ -349,14 +355,17 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
borderColor: Colors.transparent,
selectedBorderColor: Colors.transparent,
splashColor: Theme.of(context).primaryColor.withOpacity(0.1),
highlightColor: Theme.of(context).primaryColor.withOpacity(0.05),
highlightColor:
Theme.of(context).primaryColor.withOpacity(0.05),
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
padding: const EdgeInsets.symmetric(
horizontal: 24.0, vertical: 12.0),
child: Text(AppLocalizations.of(context).neft),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
padding: const EdgeInsets.symmetric(
horizontal: 24.0, vertical: 12.0),
child: Text(AppLocalizations.of(context).rtgs),
),
// Padding(

View File

@@ -70,36 +70,36 @@ class _FundTransferBeneficiaryScreenState
width: 40,
height: 40,
);
}
if (bankName != null && bankName.toLowerCase().contains('kangra central')) {
}
if (bankName != null && bankName.toLowerCase().contains('kangra central')) {
return Image.asset(
'assets/images/icon.png',
width: 40,
height: 40,
);
}
}
if (bankName != null && bankName.toLowerCase().contains('hdfc bank ltd')) {
return Image.asset(
'assets/images/hdfc_logo.png',
width: 40,
height: 40,
);
}
if (bankName != null && bankName.toLowerCase().contains('icici bank ltd')) {
}
if (bankName != null && bankName.toLowerCase().contains('icici bank ltd')) {
return Image.asset(
'assets/images/icici_logo.png',
width: 40,
height: 40,
);
}
if (bankName != null && bankName.toLowerCase().contains('punjab national bank')) {
}
if (bankName != null &&
bankName.toLowerCase().contains('punjab national bank')) {
return Image.asset(
'assets/images/pnb_logo.png',
width: 40,
height: 40,
);
}
else {
} else {
return const Icon(
Icons.account_balance,
size: 40,
@@ -128,7 +128,8 @@ class _FundTransferBeneficiaryScreenState
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(beneficiary.accountNo),
if (beneficiary.bankName != null && beneficiary.bankName!.isNotEmpty)
if (beneficiary.bankName != null &&
beneficiary.bankName!.isNotEmpty)
Text(
beneficiary.bankName!,
style: TextStyle(fontSize: 12, color: Colors.grey[600]),

View File

@@ -87,7 +87,8 @@ class _FundTransferScreen extends State<FundTransferScreen> {
),
title: Text(
AppLocalizations.of(context).fundTransfer,
style: const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
style:
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
),
centerTitle: false,
actions: const [

View File

@@ -27,7 +27,8 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
@override
void initState() {
super.initState();
_confettiController = ConfettiController(duration: const Duration(seconds: 2));
_confettiController =
ConfettiController(duration: const Duration(seconds: 2));
}
@override
@@ -41,7 +42,8 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
RenderRepaintBoundary boundary =
_shareKey.currentContext!.findRenderObject() as RenderRepaintBoundary;
ui.Image image = await boundary.toImage(pixelRatio: 3.0);
ByteData? byteData = await image.toByteData(format: ui.ImageByteFormat.png);
ByteData? byteData =
await image.toByteData(format: ui.ImageByteFormat.png);
Uint8List pngBytes = byteData!.buffer.asUint8List();
final tempDir = await getTemporaryDirectory();
@@ -129,7 +131,8 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
? Column(
children: [
Text(
AppLocalizations.of(context).paymentSuccessful,
AppLocalizations.of(context)
.paymentSuccessful,
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
@@ -160,7 +163,8 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
"Date: ${response.date!.toLocal().toIso8601String()}",
style: const TextStyle(fontSize: 16),
),
if (response.utr != null && response.utr!.isNotEmpty)
if (response.utr != null &&
response.utr!.isNotEmpty)
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Text(
@@ -182,7 +186,8 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
),
const SizedBox(height: 16),
if (response.errorMessage != null)
Text(response.errorMessage ?? '',
Text(
response.errorMessage ?? '',
style: const TextStyle(fontSize: 16),
),
],
@@ -211,10 +216,13 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
style: TextStyle(color: Theme.of(context).primaryColor),
),
style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12),
backgroundColor:
Theme.of(context).scaffoldBackgroundColor,
padding: const EdgeInsets.symmetric(
horizontal: 32, vertical: 12),
shape: RoundedRectangleBorder(
side: BorderSide(color: Theme.of(context).primaryColor, width: 1),
side: BorderSide(
color: Theme.of(context).primaryColor, width: 1),
borderRadius: BorderRadius.circular(30),
),
textStyle: const TextStyle(
@@ -226,12 +234,14 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
),
ElevatedButton.icon(
onPressed: () {
Navigator.of(context).popUntil((route) => route.isFirst);
Navigator.of(context)
.popUntil((route) => route.isFirst);
},
icon: const Icon(Icons.check),
label: Text(AppLocalizations.of(context).done),
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(horizontal: 45, vertical: 12),
padding: const EdgeInsets.symmetric(
horizontal: 45, vertical: 12),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),

View File

@@ -131,7 +131,8 @@ class _TpinOtpScreenState extends State<TpinOtpScreen> {
icon: const Icon(Icons.verified_user_rounded),
label: Text(
AppLocalizations.of(context).verifyOtp,
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
style: const TextStyle(
fontSize: 18, fontWeight: FontWeight.w600),
),
style: ElevatedButton.styleFrom(
backgroundColor: theme.colorScheme.primary,

View File

@@ -41,7 +41,8 @@ class TpinSetupPromptScreen extends StatelessWidget {
icon: const Icon(Icons.arrow_forward_rounded),
label: Text(
AppLocalizations.of(context).setTpin,
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
style:
const TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
),
style: ElevatedButton.styleFrom(
backgroundColor: theme.colorScheme.primary,

View File

@@ -173,7 +173,9 @@ class _TpinSetScreenState extends State<TpinSetScreen> {
key == '<' ? '' : key,
style: TextStyle(
fontSize: 20,
color: key == 'Enter' ? Theme.of(context).primaryColor : Colors.black,
color: key == 'Enter'
? Theme.of(context).primaryColor
: Colors.black,
),
),
),
@@ -202,7 +204,8 @@ class _TpinSetScreenState extends State<TpinSetScreen> {
child: Column(
children: [
const Spacer(),
Icon(Icons.lock_outline, size: 60, color: Theme.of(context).primaryColor),
Icon(Icons.lock_outline,
size: 60, color: Theme.of(context).primaryColor),
const SizedBox(height: 20),
Text(
getTitle(),

View File

@@ -151,7 +151,8 @@ class _TransactionPinScreenState extends State<TransactionPinScreen> {
),
title: Text(
AppLocalizations.of(context).tpin,
style: const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
style:
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
),
centerTitle: false,
),

View File

@@ -36,8 +36,8 @@ class _TransactionSuccessScreen extends State<TransactionSuccessScreen> {
@override
Widget build(BuildContext context) {
final String transactionDate = DateTime.now().toLocal().toString().split(
' ',
)[0];
' ',
)[0];
final String creditAccount = widget.creditAccount;
return Scaffold(
@@ -53,12 +53,15 @@ class _TransactionSuccessScreen extends State<TransactionSuccessScreen> {
CircleAvatar(
radius: 50,
backgroundColor: Theme.of(context).primaryColor,
child: Icon(Icons.check, color: Theme.of(context).scaffoldBackgroundColor, size: 60),
child: Icon(Icons.check,
color: Theme.of(context).scaffoldBackgroundColor,
size: 60),
),
const SizedBox(height: 24),
Text(
AppLocalizations.of(context).transactionSuccess,
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
style: const TextStyle(
fontSize: 18, fontWeight: FontWeight.w600),
textAlign: TextAlign.center,
),
const SizedBox(height: 6),
@@ -92,7 +95,8 @@ class _TransactionSuccessScreen extends State<TransactionSuccessScreen> {
style: ElevatedButton.styleFrom(
shape: const StadiumBorder(),
padding: const EdgeInsets.symmetric(vertical: 16),
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
backgroundColor:
Theme.of(context).scaffoldBackgroundColor,
foregroundColor: Theme.of(context).primaryColorLight,
side: const BorderSide(color: Colors.black, width: 1),
elevation: 0,
@@ -115,7 +119,8 @@ class _TransactionSuccessScreen extends State<TransactionSuccessScreen> {
shape: const StadiumBorder(),
padding: const EdgeInsets.symmetric(vertical: 16),
backgroundColor: Theme.of(context).primaryColorDark,
foregroundColor: Theme.of(context).scaffoldBackgroundColor,
foregroundColor:
Theme.of(context).scaffoldBackgroundColor,
),
child: Text(AppLocalizations.of(context).done),
),