111 lines
3.6 KiB
Dart
111 lines
3.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:kmobile/l10n/app_localizations.dart';
|
|
import 'package:material_symbols_icons/symbols.dart';
|
|
|
|
class TransactionDetailsScreen extends StatelessWidget {
|
|
final dynamic transaction;
|
|
|
|
const TransactionDetailsScreen({super.key, required this.transaction});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final bool isCredit = transaction.type?.toUpperCase() == 'CR';
|
|
|
|
return Scaffold(
|
|
appBar:
|
|
AppBar(title: Text(AppLocalizations.of(context).transactionDetails)),
|
|
body: Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Column(
|
|
children: [
|
|
Expanded(
|
|
flex: 3,
|
|
child: Center(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
// Amount + icon + Share Button
|
|
Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Text(
|
|
"₹ ${transaction.amount}",
|
|
style: const TextStyle(
|
|
fontSize: 40,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
const SizedBox(width: 8),
|
|
Icon(
|
|
isCredit ? Symbols.call_received : Symbols.call_made,
|
|
color: isCredit ? Colors.green : Colors.red,
|
|
size: 28,
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 8),
|
|
// Date centered
|
|
Text(
|
|
transaction.date ?? "",
|
|
style: const TextStyle(
|
|
fontSize: 16,
|
|
color: Colors.grey,
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
const Divider(),
|
|
Expanded(
|
|
flex: 5,
|
|
child: ListView(
|
|
children: [
|
|
_buildDetailRow(AppLocalizations.of(context).transactionType,
|
|
transaction.type ?? ""),
|
|
_buildDetailRow(AppLocalizations.of(context).transferType,
|
|
transaction.name.split("/").first ?? ""),
|
|
if (transaction.name.length > 12) ...[
|
|
_buildDetailRow(AppLocalizations.of(context).utrNo,
|
|
transaction.name.split("= ")[1].split(" ")[0] ?? ""),
|
|
_buildDetailRow(
|
|
AppLocalizations.of(context).beneficiaryAccountNo,
|
|
transaction.name.split("A/C ").last ?? "")
|
|
]
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildDetailRow(String label, String value) {
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
"$label: ",
|
|
style: const TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 17,
|
|
),
|
|
),
|
|
const SizedBox(height: 30),
|
|
Expanded(
|
|
child: Text(
|
|
value,
|
|
style: const TextStyle(fontSize: 16),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|