2020-01-04 19:31:52 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/entities/transaction_direction.dart';
|
2020-01-04 19:31:52 +00:00
|
|
|
import 'package:cake_wallet/generated/i18n.dart';
|
|
|
|
|
|
|
|
class TransactionRow extends StatelessWidget {
|
2020-09-26 11:17:39 +00:00
|
|
|
TransactionRow(
|
|
|
|
{this.direction,
|
|
|
|
this.formattedDate,
|
|
|
|
this.formattedAmount,
|
|
|
|
this.formattedFiatAmount,
|
|
|
|
this.isPending,
|
|
|
|
@required this.onTap});
|
2020-01-04 19:31:52 +00:00
|
|
|
|
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-12-18 18:02:08 +00:00
|
|
|
padding: EdgeInsets.fromLTRB(24, 8, 24, 8),
|
2020-07-22 10:04:11 +00:00
|
|
|
color: Colors.transparent,
|
|
|
|
child: Row(
|
2020-12-18 18:02:08 +00:00
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
height: 36,
|
|
|
|
width: 36,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
color: Theme.of(context).textTheme.overline.decorationColor
|
2020-10-02 17:28:29 +00:00
|
|
|
),
|
2020-12-18 18:02:08 +00: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>[
|
|
|
|
Text(
|
|
|
|
(direction == TransactionDirection.incoming
|
|
|
|
? S.of(context).received
|
|
|
|
: S.of(context).sent) +
|
|
|
|
(isPending ? S.of(context).pending : ''),
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: FontWeight.w500,
|
2020-12-18 19:24:05 +00:00
|
|
|
color: Theme.of(context).accentTextTheme.
|
|
|
|
display3.backgroundColor)),
|
2020-12-18 18:02:08 +00:00
|
|
|
Text(formattedAmount,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: FontWeight.w500,
|
2020-12-18 19:24:05 +00:00
|
|
|
color: Theme.of(context).accentTextTheme.
|
|
|
|
display3.backgroundColor))
|
2020-12-18 18:02:08 +00:00
|
|
|
]),
|
|
|
|
SizedBox(height: 5),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: <Widget>[
|
|
|
|
Text(formattedDate,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.textTheme
|
|
|
|
.overline
|
|
|
|
.backgroundColor)),
|
|
|
|
Text(formattedFiatAmount,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.textTheme
|
|
|
|
.overline
|
|
|
|
.backgroundColor))
|
|
|
|
])
|
|
|
|
],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
2020-01-04 19:31:52 +00:00
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|