cashumit/lib/widgets/firefly_transaction_info.dart

75 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
/// Widget untuk menampilkan informasi transaksi Firefly
/// Menampilkan sumber (kiri), panah (tengah), dan destinasi (kanan)
class FireflyTransactionInfo extends StatelessWidget {
final String sourceAccount;
final String destinationAccount;
const FireflyTransactionInfo({
super.key,
required this.sourceAccount,
required this.destinationAccount,
});
@override
Widget build(BuildContext context) {
// Mencoba menggunakan Google Fonts Courier Prime, jika gagal gunakan font sistem
TextStyle courierPrime;
try {
courierPrime = GoogleFonts.courierPrime(
textStyle: const TextStyle(
fontSize: 14,
height: 1.2,
),
);
} catch (e) {
// Fallback ke font sistem jika Google Fonts tidak tersedia
courierPrime = const TextStyle(
fontFamily: 'CourierPrime, Courier, monospace',
fontSize: 14,
height: 1.2,
);
}
return Container(
width: double.infinity,
padding: const EdgeInsets.all(8.0),
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// Sumber akun
Expanded(
flex: 3,
child: Text(
sourceAccount,
style: courierPrime,
textAlign: TextAlign.left,
overflow: TextOverflow.ellipsis,
),
),
// Panah kanan
const Expanded(
flex: 1,
child: Icon(
Icons.arrow_forward,
size: 16,
),
),
// Destinasi akun
Expanded(
flex: 3,
child: Text(
destinationAccount,
style: courierPrime,
textAlign: TextAlign.right,
overflow: TextOverflow.ellipsis,
),
),
],
),
);
}
}