Skip to content
Snippets Groups Projects
Commit 780e210e authored by Florian Schindler's avatar Florian Schindler
Browse files

Create transaction_listtile.dart

parent 9c93a831
No related branches found
No related tags found
No related merge requests found
import 'package:flutter/material.dart';
import 'package:trackeroo/logic/models/transaction.dart';
class TransactionListtile extends StatelessWidget {
const TransactionListtile({super.key, required this.transaction});
final Transaction transaction;
final monthsGer = const ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'];
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0),
margin: const EdgeInsets.only(bottom: 5.0),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.3),
borderRadius: const BorderRadius.all(Radius.circular(8.0))
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Container(
width: 30.0,
height: 30.0,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(15.0)),
color: Colors.white
),
child: Icon(transaction.category.icon),
),
const SizedBox(width: 17.0),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
transaction.title,
style: const TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold
),
),
Text(
"${transaction.category.title} · ${transaction.createdAt.day}.${monthsGer[transaction.createdAt.month]} · ${transaction.createdAt.hour}:${transaction.createdAt.minute}"
)
],
),
],
),
Text(
'${transaction.amount.toString()} €',
style: TextStyle(
color: transaction.amount.isNegative ? Colors.red[700] : Colors.green[700]
),
),
],
),
);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment