2020-01-04 21:31:52 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2021-12-24 14:37:24 +02:00
|
|
|
import 'package:cw_core/transaction_direction.dart';
|
2020-01-04 21:31:52 +02:00
|
|
|
|
|
|
|
class TransactionRow extends StatelessWidget {
|
2020-09-26 14:17:39 +03:00
|
|
|
TransactionRow(
|
2022-10-12 13:09:57 -04:00
|
|
|
{required this.direction,
|
|
|
|
required this.formattedDate,
|
|
|
|
required this.formattedAmount,
|
|
|
|
required this.formattedFiatAmount,
|
|
|
|
required this.isPending,
|
2023-02-08 18:47:12 +02:00
|
|
|
required this.title,
|
2022-10-12 13:09:57 -04:00
|
|
|
required this.onTap});
|
2020-01-04 21:31:52 +02:00
|
|
|
|
2020-01-08 14:26:34 +02:00
|
|
|
final VoidCallback onTap;
|
|
|
|
final TransactionDirection direction;
|
|
|
|
final String formattedDate;
|
|
|
|
final String formattedAmount;
|
|
|
|
final String formattedFiatAmount;
|
|
|
|
final bool isPending;
|
2023-02-08 18:47:12 +02:00
|
|
|
final String title;
|
2020-01-08 14:26:34 +02:00
|
|
|
|
2020-01-04 21:31:52 +02:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: onTap,
|
|
|
|
child: Container(
|
2020-12-18 20:02:08 +02:00
|
|
|
padding: EdgeInsets.fromLTRB(24, 8, 24, 8),
|
2020-07-22 13:04:11 +03:00
|
|
|
color: Colors.transparent,
|
|
|
|
child: Row(
|
2020-12-18 20:02:08 +02:00
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
height: 36,
|
|
|
|
width: 36,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
2022-10-12 13:09:57 -04:00
|
|
|
color: Theme.of(context).textTheme!.overline!.decorationColor!
|
2020-10-02 20:28:29 +03:00
|
|
|
),
|
2020-12-18 20:02:08 +02:00
|
|
|
child: Image.asset(
|
|
|
|
direction == TransactionDirection.incoming
|
|
|
|
? 'assets/images/down_arrow.png'
|
|
|
|
: 'assets/images/up_arrow.png'),
|
|
|
|
),
|
|
|
|
SizedBox(width: 12),
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: <Widget>[
|
2023-02-08 18:47:12 +02:00
|
|
|
Text(title,
|
2020-12-18 20:02:08 +02:00
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: FontWeight.w500,
|
2022-10-12 13:09:57 -04:00
|
|
|
color: Theme.of(context).accentTextTheme!
|
|
|
|
.headline2!.backgroundColor!)),
|
2020-12-18 20:02:08 +02:00
|
|
|
Text(formattedAmount,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: FontWeight.w500,
|
2022-10-12 13:09:57 -04:00
|
|
|
color: Theme.of(context).accentTextTheme!
|
|
|
|
.headline2!.backgroundColor!))
|
2020-12-18 20:02:08 +02:00
|
|
|
]),
|
|
|
|
SizedBox(height: 5),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: <Widget>[
|
|
|
|
Text(formattedDate,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14,
|
|
|
|
color: Theme.of(context)
|
2022-10-12 13:09:57 -04:00
|
|
|
.textTheme!
|
|
|
|
.overline!
|
|
|
|
.backgroundColor!)),
|
2020-12-18 20:02:08 +02:00
|
|
|
Text(formattedFiatAmount,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14,
|
|
|
|
color: Theme.of(context)
|
2022-10-12 13:09:57 -04:00
|
|
|
.textTheme!
|
|
|
|
.overline!
|
|
|
|
.backgroundColor!))
|
2020-12-18 20:02:08 +02:00
|
|
|
])
|
|
|
|
],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
2020-01-04 21:31:52 +02:00
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|