| 1 | import 'package:cake_wallet/entities/fiat_currency.dart'; |
| 2 | import 'package:cake_wallet/src/widgets/cake_image_widget.dart'; |
| 3 | import 'package:flutter/material.dart'; |
| 4 | |
| 5 | class FiatCurrencyRow extends StatelessWidget { |
| 6 | const FiatCurrencyRow({ |
| 7 | required this.currency, |
| 8 | required this.isSelected, |
| 9 | required this.onTap, |
| 10 | }); |
| 11 | |
| 12 | final FiatCurrency currency; |
| 13 | final bool isSelected; |
| 14 | final VoidCallback onTap; |
| 15 | |
| 16 | @override |
| 17 | Widget build(BuildContext context) { |
| 18 | final colors = Theme.of(context).colorScheme; |
| 19 | return InkWell( |
| 20 | onTap: onTap, |
| 21 | child: Padding( |
| 22 | padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12), |
| 23 | child: Row( |
| 24 | children: [ |
| 25 | ClipRRect( |
| 26 | borderRadius: BorderRadius.circular(4), |
| 27 | child: CakeImageWidget( |
| 28 | imageUrl: 'assets/images/flags/${currency.countryCode}.png', |
| 29 | width: 28, |
| 30 | height: 20, |
| 31 | fit: BoxFit.cover, |
| 32 | errorWidget: Container( |
| 33 | width: 28, |
| 34 | height: 20, |
| 35 | color: colors.surfaceContainer, |
| 36 | ), |
| 37 | ), |
| 38 | ), |
| 39 | const SizedBox(width: 12), |
| 40 | Expanded( |
| 41 | child: Column( |
| 42 | crossAxisAlignment: CrossAxisAlignment.start, |
| 43 | mainAxisSize: MainAxisSize.min, |
| 44 | children: [ |
| 45 | Text( |
| 46 | currency.fullName, |
| 47 | style: Theme.of(context).textTheme.bodyMedium?.copyWith( |
| 48 | fontWeight: FontWeight.w500, |
| 49 | ), |
| 50 | ), |
| 51 | const SizedBox(height: 2), |
| 52 | Text( |
| 53 | currency.title, |
| 54 | style: Theme.of(context).textTheme.bodySmall?.copyWith( |
| 55 | color: colors.onSurfaceVariant, |
| 56 | ), |
| 57 | ), |
| 58 | ], |
| 59 | ), |
| 60 | ), |
| 61 | if (isSelected) Icon(Icons.check, size: 20, color: colors.primary), |
| 62 | ], |
| 63 | ), |
| 64 | ), |
| 65 | ); |
| 66 | } |
| 67 | } |