| 1 | import 'package:cake_wallet/entities/new_ui_entities/list_item/list_item_regular_row.dart'; |
| 2 | import 'package:cake_wallet/generated/i18n.dart'; |
| 3 | import 'package:cake_wallet/new-ui/widgets/keyboard_hide_overlay.dart'; |
| 4 | import 'package:cake_wallet/new-ui/widgets/receive_page/receive_top_bar.dart'; |
| 5 | import 'package:cake_wallet/routes.dart'; |
| 6 | import 'package:cake_wallet/src/widgets/new_list_row/list_item_regular_row_widget.dart'; |
| 7 | import 'package:cake_wallet/src/widgets/new_list_row/new_list_section.dart'; |
| 8 | import 'package:cake_wallet/view_model/bridge/bridge_view_model.dart'; |
| 9 | import 'package:cw_core/generate_name.dart'; |
| 10 | import 'package:flutter/material.dart'; |
| 11 | import 'package:flutter_mobx/flutter_mobx.dart'; |
| 12 | |
| 13 | class BridgeNetworkPage extends StatelessWidget { |
| 14 | const BridgeNetworkPage(this.bridgeViewModel); |
| 15 | |
| 16 | final BridgeViewModel bridgeViewModel; |
| 17 | |
| 18 | @override |
| 19 | Widget build(BuildContext context) { |
| 20 | final theme = Theme.of(context); |
| 21 | |
| 22 | return KeyboardHideOverlay( |
| 23 | unfocusOnTap: true, |
| 24 | child: Container( |
| 25 | decoration: BoxDecoration( |
| 26 | color: theme.colorScheme.surface, |
| 27 | borderRadius: const BorderRadius.vertical(top: Radius.circular(16)), |
| 28 | ), |
| 29 | child: Column( |
| 30 | children: [ |
| 31 | ModalTopBar( |
| 32 | title: 'Destination Network', |
| 33 | leadingIcon: const Icon(Icons.arrow_back_ios_new, size: 18), |
| 34 | leadingSemanticLabel: S.of(context).seed_alert_back, |
| 35 | onLeadingPressed: () => Navigator.of(context).pop(), |
| 36 | ), |
| 37 | SizedBox(height: 48), |
| 38 | Padding( |
| 39 | padding: const EdgeInsets.fromLTRB(18, 8, 18, 16), |
| 40 | child: Text( |
| 41 | 'Select what Network to transfer your assets to', |
| 42 | textAlign: TextAlign.center, |
| 43 | style: theme.textTheme.bodyMedium?.copyWith( |
| 44 | color: theme.colorScheme.onSurfaceVariant, |
| 45 | ), |
| 46 | ), |
| 47 | ), |
| 48 | SizedBox(height: 24), |
| 49 | Expanded( |
| 50 | child: Padding( |
| 51 | padding: const EdgeInsets.symmetric(horizontal: 18), |
| 52 | child: Column( |
| 53 | children: [ |
| 54 | Observer( |
| 55 | builder: (_) { |
| 56 | return NewListSections( |
| 57 | sections: { |
| 58 | '': bridgeViewModel.availableDestinationChains.map( |
| 59 | (chain) { |
| 60 | final chainName = chain.name; |
| 61 | return ListItemRegularRow( |
| 62 | iconPath: |
| 63 | 'assets/new-ui/crypto_full_icons/${chainName.toLowerCase()}.svg', |
| 64 | keyValue: chain.chainId.toString(), |
| 65 | label: chainName, |
| 66 | onTap: () { |
| 67 | bridgeViewModel.setDestinationChain(chain.chainId); |
| 68 | Navigator.pushNamed(context, Routes.bridgeReceivingWalletPage, |
| 69 | arguments: bridgeViewModel); |
| 70 | }, |
| 71 | ); |
| 72 | }, |
| 73 | ).toList(), |
| 74 | }, |
| 75 | ); |
| 76 | }, |
| 77 | ), |
| 78 | SizedBox(height: 24), |
| 79 | Observer( |
| 80 | builder: (_) { |
| 81 | final src = bridgeViewModel.wallet.type.name; |
| 82 | |
| 83 | return ListItemRegularRowWidget( |
| 84 | isFirstInSection: true, |
| 85 | isLastInSection: true, |
| 86 | keyValue: 'sending_from', |
| 87 | label: 'Sending from', |
| 88 | trailingIconPath: 'assets/new-ui/chain_badges/${src.toLowerCase()}.svg', |
| 89 | trailingText: src.capitalized(), |
| 90 | ); |
| 91 | }, |
| 92 | ), |
| 93 | ], |
| 94 | ), |
| 95 | ), |
| 96 | ), |
| 97 | ], |
| 98 | ), |
| 99 | ), |
| 100 | ); |
| 101 | } |
| 102 | } |