| 1 | import 'package:cake_wallet/generated/i18n.dart'; |
| 2 | import 'package:flutter/material.dart'; |
| 3 | |
| 4 | class PayjoinTransactionRow extends StatelessWidget { |
| 5 | PayjoinTransactionRow({ |
| 6 | required this.createdAt, |
| 7 | required this.currency, |
| 8 | required this.onTap, |
| 9 | required this.amount, |
| 10 | required this.state, |
| 11 | required this.isSending, |
| 12 | super.key, |
| 13 | }); |
| 14 | |
| 15 | final VoidCallback? onTap; |
| 16 | final String createdAt; |
| 17 | final String amount; |
| 18 | final String currency; |
| 19 | final String state; |
| 20 | final bool isSending; |
| 21 | |
| 22 | @override |
| 23 | Widget build(BuildContext context) { |
| 24 | return InkWell( |
| 25 | onTap: onTap, |
| 26 | child: Container( |
| 27 | padding: EdgeInsets.fromLTRB(24, 8, 24, 8), |
| 28 | color: Colors.transparent, |
| 29 | child: Row( |
| 30 | mainAxisSize: MainAxisSize.max, |
| 31 | crossAxisAlignment: CrossAxisAlignment.center, |
| 32 | children: [ |
| 33 | _getImage(), |
| 34 | SizedBox(width: 12), |
| 35 | Expanded( |
| 36 | child: Column( |
| 37 | mainAxisSize: MainAxisSize.min, |
| 38 | children: [ |
| 39 | Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ |
| 40 | Text( |
| 41 | "${isSending ? S.current.outgoing : S.current.incoming} Payjoin", |
| 42 | style: Theme.of(context).textTheme.bodyMedium?.copyWith( |
| 43 | fontWeight: FontWeight.w500, |
| 44 | color: Theme.of(context).colorScheme.onSurface, |
| 45 | ), |
| 46 | ), |
| 47 | Text( |
| 48 | amount + ' ' + currency, |
| 49 | style: Theme.of(context).textTheme.bodyMedium?.copyWith( |
| 50 | fontWeight: FontWeight.w500, |
| 51 | color: Theme.of(context).colorScheme.onSurface, |
| 52 | ), |
| 53 | ) |
| 54 | ]), |
| 55 | SizedBox(height: 5), |
| 56 | Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ |
| 57 | Text( |
| 58 | createdAt, |
| 59 | style: Theme.of(context).textTheme.bodySmall?.copyWith( |
| 60 | color: Theme.of(context).colorScheme.onSurfaceVariant, |
| 61 | ), |
| 62 | ), |
| 63 | Text( |
| 64 | state, |
| 65 | style: Theme.of(context).textTheme.bodySmall?.copyWith( |
| 66 | color: Theme.of(context).colorScheme.onSurfaceVariant, |
| 67 | ), |
| 68 | ), |
| 69 | ]) |
| 70 | ], |
| 71 | )) |
| 72 | ], |
| 73 | ), |
| 74 | )); |
| 75 | } |
| 76 | |
| 77 | Widget _getImage() => ClipRRect( |
| 78 | borderRadius: BorderRadius.circular(50), |
| 79 | child: Image.asset( |
| 80 | 'assets/images/payjoin.png', |
| 81 | width: 36, |
| 82 | height: 36, |
| 83 | ), |
| 84 | ); |
| 85 | } |