| 1 | import 'package:cake_wallet/generated/i18n.dart'; |
| 2 | import 'package:cake_wallet/new-ui/widgets/currency_picker/currency_picker_args.dart'; |
| 3 | import 'package:cake_wallet/new-ui/widgets/currency_picker/multi_network_currency_picker.dart'; |
| 4 | import 'package:cake_wallet/new-ui/widgets/currency_picker/single_network_currency_picker.dart'; |
| 5 | import 'package:cake_wallet/new-ui/widgets/receive_page/receive_top_bar.dart'; |
| 6 | import 'package:flutter/material.dart'; |
| 7 | |
| 8 | class CurrencyPickerSheet extends StatelessWidget { |
| 9 | const CurrencyPickerSheet({super.key, required this.args}); |
| 10 | |
| 11 | final CurrencyPickerArgs args; |
| 12 | |
| 13 | static Future<void> show({ |
| 14 | required BuildContext context, |
| 15 | required CurrencyPickerArgs args, |
| 16 | }) { |
| 17 | return showModalBottomSheet<void>( |
| 18 | context: context, |
| 19 | isScrollControlled: true, |
| 20 | useSafeArea: true, |
| 21 | enableDrag: false, |
| 22 | isDismissible: false, |
| 23 | backgroundColor: Colors.transparent, |
| 24 | builder: (_) => CurrencyPickerSheet(args: args), |
| 25 | ); |
| 26 | } |
| 27 | |
| 28 | @override |
| 29 | Widget build(BuildContext context) { |
| 30 | final colors = Theme.of(context).colorScheme; |
| 31 | return Padding( |
| 32 | padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), |
| 33 | child: Container( |
| 34 | decoration: BoxDecoration( |
| 35 | borderRadius: const BorderRadius.vertical(top: Radius.circular(24)), |
| 36 | color: colors.surface, |
| 37 | ), |
| 38 | child: SafeArea( |
| 39 | top: false, |
| 40 | child: Column( |
| 41 | mainAxisSize: MainAxisSize.max, |
| 42 | children: [ |
| 43 | ModalTopBar( |
| 44 | title: S.of(context).select_asset, |
| 45 | leadingIcon: const Icon(Icons.close), |
| 46 | leadingSemanticLabel: S.of(context).close, |
| 47 | onLeadingPressed: () => Navigator.of(context).maybePop(), |
| 48 | ), |
| 49 | Expanded( |
| 50 | child: args.useSingleNetworkLayout |
| 51 | ? SingleNetworkCurrencyPicker(args: args) |
| 52 | : MultiNetworkCurrencyPicker(args: args), |
| 53 | ), |
| 54 | ], |
| 55 | ), |
| 56 | ), |
| 57 | ), |
| 58 | ); |
| 59 | } |
| 60 | } |