66 lines
2.1 KiB
Dart
66 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:intl/intl.dart';
|
|
import 'package:tunas/repositories/account/models/transaction.dart';
|
|
|
|
class TransactionLine extends StatelessWidget {
|
|
final Transaction transaction;
|
|
final double subTotal;
|
|
|
|
const TransactionLine({super.key, required this.transaction, required this.subTotal});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MergeSemantics(
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(vertical: 9, horizontal: 10),
|
|
margin: const EdgeInsets.symmetric(vertical: 2, horizontal: 10),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
SizedBox(
|
|
width: 100,
|
|
child: Text(DateFormat('dd-MM-yyyy', 'fr_FR').format(transaction.date))
|
|
),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
transaction.category,
|
|
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 18)
|
|
),
|
|
Text(transaction.description),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 100,
|
|
child: Text(transaction.account),
|
|
),
|
|
SizedBox(
|
|
width: 120,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
children: [
|
|
Text(
|
|
NumberFormat(transaction.value > 0 ? '+#######.00 €' : '#######.00 €', 'fr_FR').format(transaction.value),
|
|
style: TextStyle(
|
|
color: transaction.value > 0 ? Colors.green : Colors.red
|
|
)
|
|
),
|
|
Text(
|
|
NumberFormat('#######.00 €', 'fr_FR').format(subTotal),
|
|
style: TextStyle(
|
|
color: subTotal > 0 ? Colors.green : Colors.red
|
|
)
|
|
),
|
|
],
|
|
),
|
|
)
|
|
],
|
|
)
|
|
)
|
|
);
|
|
}
|
|
}
|