Files
enaklo-flutter/lib/presentation/pages/wallet/widgets/wallet_transaction_tile.dart
T
efrilmandClaude Opus 5.5 f5e3075205 EnakPoint & EnakCoin wallet, PIN, outlet, order, community, reward
- Wallet EnakPoint & EnakCoin: beranda, riwayat, saldo kedaluwarsa, kode
  bayar, tukar EnakCoin, transfer
- PIN (buat, ganti, lupa), outlet, riwayat order, game spin
- Halaman community, webview, coming soon, dan ikon menu beranda baru
- Redesign Reward Saya: kartu tiket, filter chip, detail kode + QR
- Hapus customer point loader, menu, dan checkout lama
- Base URL ke enaklo-pos-api.altru.id

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 01:43:22 +07:00

114 lines
3.6 KiB
Dart

import 'package:flutter/material.dart';
import '../../../../common/theme/theme.dart';
import '../../../../domain/wallet/wallet.dart';
import '../wallet_ui.dart';
class WalletTransactionTile extends StatelessWidget {
const WalletTransactionTile({
super.key,
required this.transaction,
this.showCurrency = false,
});
final WalletTransaction transaction;
/// Tampilkan mata uang di samping jumlah, untuk list yang mencampur
/// EnakPoint & EnakCoin. Satu order menghasilkan dua transaksi (POINT dan
/// COIN) dengan deskripsi dan jumlah yang sama.
final bool showCurrency;
@override
Widget build(BuildContext context) {
final tx = transaction;
final color = signedAmountColor(tx.amount);
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: color.withOpacity(0.1),
shape: BoxShape.circle,
),
child: Icon(
tx.isIncoming ? Icons.south_west : Icons.north_east,
color: color,
size: 20,
),
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
tx.type.label,
style: AppStyle.md.copyWith(fontWeight: FontWeight.w700),
),
if (tx.description.isNotEmpty) ...[
const SizedBox(height: 2),
Text(
tx.description,
style: AppStyle.sm.copyWith(color: AppColor.textSecondary),
),
],
if (tx.createdAt != null) ...[
const SizedBox(height: 2),
Text(
formatWibDateTime(tx.createdAt!),
style: AppStyle.xs.copyWith(color: AppColor.textSecondary),
),
],
if (tx.isIncoming && tx.expiresAt != null) ...[
const SizedBox(height: 4),
Text(
'Berlaku sampai ${formatWibDate(tx.expiresAt!)}',
style: AppStyle.xs.copyWith(
color: AppColor.warning,
fontWeight: FontWeight.w600,
),
),
],
],
),
),
const SizedBox(width: 8),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
formatSignedAmount(tx.amount),
style: AppStyle.md.copyWith(
color: color,
fontWeight: FontWeight.w700,
),
),
if (showCurrency) ...[
const SizedBox(width: 4),
WalletCurrencyIcon(currency: tx.currency, size: 16),
],
],
),
if (showCurrency) ...[
const SizedBox(height: 2),
Text(
tx.currency.label,
style: AppStyle.xs.copyWith(color: AppColor.textSecondary),
),
],
],
),
],
),
);
}
}