Minor Changes of const and bank logos

This commit is contained in:
2025-08-12 13:19:24 +05:30
parent 82951b7919
commit 7f5258b5b7
34 changed files with 166 additions and 840 deletions

View File

@@ -1,3 +1,5 @@
// ignore_for_file: avoid_print
import 'dart:async';
import 'dart:convert';

View File

@@ -1,93 +1,3 @@
/*import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
// import 'package:kmobile/features/beneficiaries/screens/add_beneficiary_screen.dart';
import 'package:kmobile/features/fund_transfer/screens/fund_transfer_screen.dart';
import 'package:material_symbols_icons/material_symbols_icons.dart';
import '../../../l10n/app_localizations.dart';
class FundTransferBeneficiaryScreen extends StatefulWidget {
const FundTransferBeneficiaryScreen({super.key});
@override
State<FundTransferBeneficiaryScreen> createState() =>
_FundTransferBeneficiaryScreen();
}
class _FundTransferBeneficiaryScreen
extends State<FundTransferBeneficiaryScreen> {
final List<Map<String, String>> beneficiaries = [
{'bank': 'State Bank Of India', 'name': 'Trina Bakshi'},
{'bank': 'State Bank Of India', 'name': 'Sheetal Rao'},
{'bank': 'Punjab National Bank', 'name': 'Manoj Kumar'},
{'bank': 'State Bank Of India', 'name': 'Rohit Mehra'},
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: const Icon(Symbols.arrow_back_ios_new),
onPressed: () {
Navigator.pop(context);
},
),
title: Text(
AppLocalizations.of(context).fundTransferBeneficiary,
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
),
centerTitle: false,
actions: [
Padding(
padding: const EdgeInsets.only(right: 10.0),
child: CircleAvatar(
backgroundColor: Colors.grey[200],
radius: 20,
child: SvgPicture.asset(
'assets/images/avatar_male.svg',
width: 40,
height: 40,
fit: BoxFit.cover,
),
),
),
],
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: ListView.builder(
itemCount: beneficiaries.length,
itemBuilder: (context, index) {
final beneficiary = beneficiaries[index];
return ListTile(
leading: CircleAvatar(
backgroundColor: Theme.of(context).primaryColor,
child: Text('A'),
),
title: Text(beneficiary['name']!),
subtitle: Text(beneficiary['bank']!),
trailing: IconButton(
icon: const Icon(Symbols.arrow_right, size: 20),
onPressed: () {
// Delete action
},
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const FundTransferScreen(),
),
);
},
);
},
),
),
);
}
}*/
import 'package:flutter/material.dart';
import 'package:kmobile/data/models/beneficiary.dart';
import 'package:kmobile/features/fund_transfer/screens/fund_transfer_amount_screen.dart';

View File

@@ -87,7 +87,7 @@ class _FundTransferScreen extends State<FundTransferScreen> {
),
title: Text(
AppLocalizations.of(context).fundTransfer,
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
style: const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
),
centerTitle: false,
actions: const [
@@ -108,7 +108,7 @@ class _FundTransferScreen extends State<FundTransferScreen> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(AppLocalizations.of(context).debitFrom),
Text(
const Text(
'0300015678903456',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
),
@@ -117,7 +117,7 @@ class _FundTransferScreen extends State<FundTransferScreen> {
const SizedBox(height: 20),
Text(
AppLocalizations.of(context).enterAmount,
style: TextStyle(fontSize: 20),
style: const TextStyle(fontSize: 20),
),
const SizedBox(height: 20),
Container(

View File

@@ -1,3 +1,4 @@
// ignore_for_file: use_build_context_synchronously
import 'dart:io';
import 'dart:typed_data';
import 'dart:ui' as ui;
@@ -10,222 +11,6 @@ import 'package:path_provider/path_provider.dart';
import '../../../l10n/app_localizations.dart';
import 'package:confetti/confetti.dart';
/*class PaymentAnimationScreen extends StatefulWidget {
final Future<PaymentResponse> paymentResponse;
const PaymentAnimationScreen({super.key, required this.paymentResponse});
@override
State<PaymentAnimationScreen> createState() => _PaymentAnimationScreenState();
}
class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
final GlobalKey _shareKey = GlobalKey();
Future<void> _shareScreenshot() async {
try {
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,
);
Uint8List pngBytes = byteData!.buffer.asUint8List();
final tempDir = await getTemporaryDirectory();
final file = await File('${tempDir.path}/payment_result.png').create();
await file.writeAsBytes(pngBytes);
await Share.shareXFiles([
XFile(file.path),
], text: '${AppLocalizations.of(context).paymentResult}');
} catch (e) {
if (!mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'${AppLocalizations.of(context).failedToShareScreenshot}: $e',
),
),
);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: FutureBuilder<PaymentResponse>(
future: widget.paymentResponse,
builder: (context, snapshot) {
if (!snapshot.hasData) {
return Center(
child: Lottie.asset(
'assets/animations/rupee.json',
width: 200,
height: 200,
repeat: true,
),
);
}
final response = snapshot.data!;
final isSuccess = response.isSuccess;
return Stack(
children: [
Center(
child: RepaintBoundary(
key: _shareKey,
child: Container(
color: Theme.of(context).scaffoldBackgroundColor,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(height: 80),
Lottie.asset(
isSuccess
? 'assets/animations/done.json'
: 'assets/animations/error.json',
width: 200,
height: 200,
repeat: false,
),
const SizedBox(height: 10),
isSuccess
? Column(
children: [
Text(
AppLocalizations.of(
context,
).paymentSuccessful,
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
color: Colors.green,
),
),
const SizedBox(height: 16),
if (response.amount != null)
Text(
'${AppLocalizations.of(context).amount}: ${response.amount} ${response.currency ?? ''}',
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w700,
fontFamily: 'Rubik',
),
),
if (response.creditedAccount != null)
Text(
'${AppLocalizations.of(context).creditedAccount}: ${response.creditedAccount}',
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
fontFamily: 'Rubik',
),
),
if (response.date != null)
Text(
'Date: ${response.date!.toLocal().toIso8601String()}',
style: const TextStyle(fontSize: 16),
),
],
)
: Column(
children: [
Text(
AppLocalizations.of(context).paymentFailed,
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
color: Colors.red,
),
),
const SizedBox(height: 16),
if (response.errorMessage != null)
Text(
response.errorMessage!,
style: const TextStyle(fontSize: 16),
),
],
),
const SizedBox(height: 40),
],
),
),
),
),
// Buttons at the bottom
Positioned(
left: 0,
right: 0,
bottom: 80,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
ElevatedButton.icon(
onPressed: _shareScreenshot,
icon: Icon(
Icons.share_rounded,
color: Theme.of(context).primaryColor,
),
label: Text(
AppLocalizations.of(context).share,
style: TextStyle(color: Theme.of(context).primaryColor),
),
style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(
context,
).scaffoldBackgroundColor,
padding: const EdgeInsets.symmetric(
horizontal: 32,
vertical: 12,
),
shape: RoundedRectangleBorder(
side: BorderSide(
color: Theme.of(context).primaryColor,
width: 1,
),
borderRadius: BorderRadius.circular(30),
),
textStyle: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Colors.black,
),
),
),
ElevatedButton.icon(
onPressed: () {
Navigator.of(
context,
).popUntil((route) => route.isFirst);
},
label: Text(AppLocalizations.of(context).done),
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 45,
vertical: 12,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
textStyle: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
),
],
),
),
],
);
},
),
);
}
}*/
class PaymentAnimationScreen extends StatefulWidget {
final Future<PaymentResponse> paymentResponse;
@@ -398,7 +183,7 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
const SizedBox(height: 16),
if (response.errorMessage != null)
Text(response.errorMessage ?? '',
style: TextStyle(fontSize: 16),
style: const TextStyle(fontSize: 16),
),
],
),

View File

@@ -1,5 +1,4 @@
import '../../../l10n/app_localizations.dart';
import 'package:flutter/material.dart';
import 'package:kmobile/features/fund_transfer/screens/tpin_set_screen.dart';
@@ -132,7 +131,7 @@ class _TpinOtpScreenState extends State<TpinOtpScreen> {
icon: const Icon(Icons.verified_user_rounded),
label: Text(
AppLocalizations.of(context).verifyOtp,
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
),
style: ElevatedButton.styleFrom(
backgroundColor: theme.colorScheme.primary,

View File

@@ -1,5 +1,4 @@
import '../../../l10n/app_localizations.dart';
import 'package:flutter/material.dart';
import 'package:kmobile/features/fund_transfer/screens/tpin_otp_screen.dart';
@@ -42,7 +41,7 @@ class TpinSetupPromptScreen extends StatelessWidget {
icon: const Icon(Icons.arrow_forward_rounded),
label: Text(
AppLocalizations.of(context).setTpin,
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
),
style: ElevatedButton.styleFrom(
backgroundColor: theme.colorScheme.primary,

View File

@@ -55,6 +55,7 @@ class _TpinSetScreenState extends State<TpinSetScreen> {
await authService.setTpin(pin);
} catch (e) {
setState(() {
// ignore: unnecessary_string_interpolations
_errorText = "${AppLocalizations.of(context).tpinFailed}";
_tpin.clear();
});
@@ -71,11 +72,11 @@ class _TpinSetScreenState extends State<TpinSetScreen> {
),
title: Column(
children: [
Icon(Icons.check_circle, color: Colors.green, size: 60),
SizedBox(height: 12),
const Icon(Icons.check_circle, color: Colors.green, size: 60),
const SizedBox(height: 12),
Text(
AppLocalizations.of(context).success,
style: TextStyle(fontWeight: FontWeight.bold),
style: const TextStyle(fontWeight: FontWeight.bold),
),
],
),
@@ -90,7 +91,7 @@ class _TpinSetScreenState extends State<TpinSetScreen> {
},
child: Text(
AppLocalizations.of(context).ok,
style: TextStyle(fontSize: 16),
style: const TextStyle(fontSize: 16),
),
),
],

View File

@@ -58,7 +58,7 @@ class _TransactionSuccessScreen extends State<TransactionSuccessScreen> {
const SizedBox(height: 24),
Text(
AppLocalizations.of(context).transactionSuccess,
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
textAlign: TextAlign.center,
),
const SizedBox(height: 6),