TKK_E32230211/lib/app/widgets/history_card_widget.dart

84 lines
2.2 KiB
Dart

import 'package:flutter/material.dart';
class HistoryCardWidget extends StatelessWidget {
final String amount;
final String date;
final String percent;
final String tipe;
const HistoryCardWidget({
super.key,
required this.amount,
required this.date,
required this.percent,
this.tipe = 'masuk',
});
@override
Widget build(BuildContext context) {
final isMasuk = tipe == 'masuk';
final color = isMasuk ? const Color(0xFF5B9BD5) : Colors.redAccent;
final icon = isMasuk
? Icons.arrow_upward_rounded
: Icons.arrow_downward_rounded;
return Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: Row(
children: [
Container(
width: 44,
height: 44,
decoration: BoxDecoration(
color: isMasuk
? const Color(0xFFEAF4FC)
: const Color(0xFFFFEBEB),
borderRadius: BorderRadius.circular(10),
),
child: Icon(
Icons.account_balance_wallet_outlined,
color: color,
size: 22,
),
),
const SizedBox(width: 14),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
amount,
style: const TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
const SizedBox(height: 3),
Text(
date,
style: const TextStyle(fontSize: 12, color: Colors.grey),
),
],
),
),
Row(
children: [
Icon(icon, color: color, size: 14),
const SizedBox(width: 2),
Text(
percent,
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w600,
color: color,
),
),
],
),
],
),
);
}
}