This commit is contained in:
2025-08-06 17:26:25 +05:30
parent 2fdef7c850
commit c4d4261afc
33 changed files with 772 additions and 935 deletions

View File

@@ -60,8 +60,8 @@ class _FundTransferBeneficiaryScreen
itemBuilder: (context, index) {
final beneficiary = beneficiaries[index];
return ListTile(
leading: const CircleAvatar(
backgroundColor: Colors.blue,
leading: CircleAvatar(
backgroundColor: Theme.of(context).primaryColor,
child: Text('A'),
),
title: Text(beneficiary['name']!),
@@ -96,7 +96,7 @@ class _FundTransferBeneficiaryScreen
);
},
backgroundColor: Colors.grey[300],
foregroundColor: Colors.blue[900],
foregroundColor: Theme.of(context).primaryColor,
elevation: 5,
child: const Icon(Icons.add),
),

View File

@@ -135,7 +135,7 @@ class _FundTransferScreen extends State<FundTransferScreen> {
const Spacer(),
Container(
padding: const EdgeInsets.all(16.0),
color: Colors.white,
color: Theme.of(context).scaffoldBackgroundColor,
child: GridView.count(
crossAxisCount: 3,
shrinkWrap: true,

View File

@@ -8,8 +8,9 @@ import 'package:lottie/lottie.dart';
import 'package:share_plus/share_plus.dart';
import 'package:path_provider/path_provider.dart';
import '../../../l10n/app_localizations.dart';
import 'package:confetti/confetti.dart';
class PaymentAnimationScreen extends StatefulWidget {
/*class PaymentAnimationScreen extends StatefulWidget {
final Future<PaymentResponse> paymentResponse;
const PaymentAnimationScreen({super.key, required this.paymentResponse});
@@ -97,7 +98,7 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
AppLocalizations.of(
context,
).paymentSuccessful,
style: TextStyle(
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
color: Colors.green,
@@ -133,7 +134,7 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
children: [
Text(
AppLocalizations.of(context).paymentFailed,
style: TextStyle(
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
color: Colors.red,
@@ -223,4 +224,238 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
),
);
}
}*/
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();
late ConfettiController _confettiController;
@override
void initState() {
super.initState();
_confettiController = ConfettiController(duration: const Duration(seconds: 2));
}
@override
void dispose() {
_confettiController.dispose();
super.dispose();
}
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;
if (isSuccess) _confettiController.play();
return Stack(
children: [
Align(
alignment: Alignment.topCenter,
child: ConfettiWidget(
confettiController: _confettiController,
blastDirectionality: BlastDirectionality.explosive,
emissionFrequency: 0.2,
numberOfParticles: 40,
gravity: 0.3,
maxBlastForce: 25,
minBlastForce: 10,
shouldLoop: false,
colors: const [
Colors.green,
Colors.blue,
Colors.pink,
Colors.orange,
],
),
),
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),
],
),
),
),
),
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);
},
icon: const Icon(Icons.check),
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,
),
),
),
],
),
),
],
);
},
),
);
}
}

View File

@@ -73,8 +73,8 @@ class _TransactionPinScreen extends State<TransactionPinScreen> {
height: 20,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(color: Colors.blue, width: 2),
color: index < _pin.length ? Colors.blue : Colors.transparent,
border: Border.all(color: Theme.of(context).primaryColor, width: 2),
color: index < _pin.length ? Theme.of(context).primaryColor : Colors.transparent,
),
);
}),

View File

@@ -50,10 +50,10 @@ class _TransactionSuccessScreen extends State<TransactionSuccessScreen> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const CircleAvatar(
CircleAvatar(
radius: 50,
backgroundColor: Colors.blue,
child: Icon(Icons.check, color: Colors.white, size: 60),
backgroundColor: Theme.of(context).primaryColor,
child: Icon(Icons.check, color: Theme.of(context).scaffoldBackgroundColor, size: 60),
),
const SizedBox(height: 24),
Text(
@@ -92,8 +92,8 @@ class _TransactionSuccessScreen extends State<TransactionSuccessScreen> {
style: ElevatedButton.styleFrom(
shape: const StadiumBorder(),
padding: const EdgeInsets.symmetric(vertical: 16),
backgroundColor: Colors.white,
foregroundColor: Colors.blueAccent,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
foregroundColor: Theme.of(context).primaryColorLight,
side: const BorderSide(color: Colors.black, width: 1),
elevation: 0,
),
@@ -114,8 +114,8 @@ class _TransactionSuccessScreen extends State<TransactionSuccessScreen> {
style: ElevatedButton.styleFrom(
shape: const StadiumBorder(),
padding: const EdgeInsets.symmetric(vertical: 16),
backgroundColor: Colors.blue[900],
foregroundColor: Colors.white,
backgroundColor: Theme.of(context).primaryColorDark,
foregroundColor: Theme.of(context).scaffoldBackgroundColor,
),
child: Text(AppLocalizations.of(context).done),
),