| 1 | import 'package:cake_wallet/entities/fiat_currency.dart'; |
| 2 | import 'package:cake_wallet/generated/i18n.dart'; |
| 3 | import 'package:cake_wallet/new-ui/widgets/currency_picker/currency_picker_list_container.dart'; |
| 4 | import 'package:cake_wallet/new-ui/widgets/currency_picker/fiat_currency_row.dart'; |
| 5 | import 'package:flutter/material.dart'; |
| 6 | |
| 7 | class FiatCurrencySearchResults extends StatelessWidget { |
| 8 | const FiatCurrencySearchResults({ |
| 9 | super.key, |
| 10 | required this.items, |
| 11 | required this.onSelected, |
| 12 | required this.selected, |
| 13 | }); |
| 14 | |
| 15 | final List<FiatCurrency> items; |
| 16 | final void Function(FiatCurrency) onSelected; |
| 17 | final FiatCurrency? selected; |
| 18 | |
| 19 | @override |
| 20 | Widget build(BuildContext context) { |
| 21 | if (items.isEmpty) { |
| 22 | return Center( |
| 23 | child: Padding( |
| 24 | padding: const EdgeInsets.all(24), |
| 25 | child: Text( |
| 26 | S.of(context).picker_no_matches, |
| 27 | textAlign: TextAlign.center, |
| 28 | style: Theme.of(context).textTheme.bodyMedium?.copyWith( |
| 29 | color: Theme.of(context).colorScheme.onSurfaceVariant, |
| 30 | ), |
| 31 | ), |
| 32 | ), |
| 33 | ); |
| 34 | } |
| 35 | |
| 36 | return ListView( |
| 37 | padding: const EdgeInsets.fromLTRB(16, 8, 16, 16), |
| 38 | children: [ |
| 39 | CurrencyPickerListContainer( |
| 40 | rows: [ |
| 41 | for (final c in items) |
| 42 | FiatCurrencyRow( |
| 43 | currency: c, |
| 44 | isSelected: c == selected, |
| 45 | onTap: () => onSelected(c), |
| 46 | ), |
| 47 | ], |
| 48 | ), |
| 49 | ], |
| 50 | ); |
| 51 | } |
| 52 | } |