2020-01-04 19:31:52 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:cake_wallet/palette.dart';
|
|
|
|
import 'package:cake_wallet/src/domain/common/transaction_direction.dart';
|
|
|
|
import 'package:cake_wallet/generated/i18n.dart';
|
|
|
|
|
|
|
|
class TransactionRow extends StatelessWidget {
|
|
|
|
TransactionRow(
|
|
|
|
{this.direction,
|
|
|
|
this.formattedDate,
|
|
|
|
this.formattedAmount,
|
|
|
|
this.formattedFiatAmount,
|
|
|
|
this.isPending,
|
|
|
|
@required this.onTap});
|
|
|
|
|
2020-01-08 12:26:34 +00:00
|
|
|
final VoidCallback onTap;
|
|
|
|
final TransactionDirection direction;
|
|
|
|
final String formattedDate;
|
|
|
|
final String formattedAmount;
|
|
|
|
final String formattedFiatAmount;
|
|
|
|
final bool isPending;
|
|
|
|
|
2020-01-04 19:31:52 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: onTap,
|
|
|
|
child: Container(
|
2020-07-06 20:09:03 +00:00
|
|
|
height: 41,
|
|
|
|
color: Theme.of(context).backgroundColor,
|
|
|
|
padding: EdgeInsets.only(left: 20, right: 20),
|
2020-01-04 19:31:52 +00:00
|
|
|
child: Row(children: <Widget>[
|
2020-04-16 18:41:04 +00:00
|
|
|
Container(
|
|
|
|
height: 36,
|
|
|
|
width: 36,
|
|
|
|
decoration: BoxDecoration(
|
2020-07-06 20:09:03 +00:00
|
|
|
shape: BoxShape.circle,
|
|
|
|
color: Theme.of(context).primaryTextTheme.display3.color),
|
|
|
|
child: Image.asset(direction == TransactionDirection.incoming
|
|
|
|
? 'assets/images/down_arrow.png'
|
|
|
|
: 'assets/images/up_arrow.png'),
|
2020-04-16 18:41:04 +00:00
|
|
|
),
|
2020-01-04 19:31:52 +00:00
|
|
|
Expanded(
|
|
|
|
child: Padding(
|
2020-04-16 18:41:04 +00:00
|
|
|
padding: const EdgeInsets.only(left: 10),
|
2020-01-04 19:31:52 +00:00
|
|
|
child: Column(
|
2020-04-16 18:41:04 +00:00
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
2020-01-04 19:31:52 +00:00
|
|
|
children: <Widget>[
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: <Widget>[
|
|
|
|
Text(
|
|
|
|
(direction == TransactionDirection.incoming
|
|
|
|
? S.of(context).received
|
|
|
|
: S.of(context).sent) +
|
|
|
|
(isPending ? S.of(context).pending : ''),
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16,
|
2020-07-06 20:09:03 +00:00
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.primaryTextTheme
|
|
|
|
.title
|
|
|
|
.color)),
|
|
|
|
Text(
|
|
|
|
direction == TransactionDirection.incoming
|
|
|
|
? formattedAmount
|
|
|
|
: '- ' + formattedAmount,
|
2020-05-29 15:10:11 +00:00
|
|
|
style: TextStyle(
|
2020-04-17 19:40:11 +00:00
|
|
|
fontSize: 16,
|
2020-07-06 20:09:03 +00:00
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.primaryTextTheme
|
|
|
|
.title
|
|
|
|
.color))
|
2020-01-04 19:31:52 +00:00
|
|
|
]),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: <Widget>[
|
|
|
|
Text(formattedDate,
|
2020-05-29 15:10:11 +00:00
|
|
|
style: TextStyle(
|
2020-07-06 20:09:03 +00:00
|
|
|
fontSize: 14,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.primaryTextTheme
|
|
|
|
.headline
|
|
|
|
.color)),
|
|
|
|
Text(
|
|
|
|
direction == TransactionDirection.incoming
|
|
|
|
? formattedFiatAmount
|
|
|
|
: '- ' + formattedFiatAmount,
|
2020-05-29 15:10:11 +00:00
|
|
|
style: TextStyle(
|
2020-07-06 20:09:03 +00:00
|
|
|
fontSize: 14,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.primaryTextTheme
|
|
|
|
.headline
|
|
|
|
.color))
|
2020-01-04 19:31:52 +00:00
|
|
|
]),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
))
|
|
|
|
]),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|