| 1 | import "package:cake_wallet/generated/i18n.dart"; |
| 2 | import "package:cake_wallet/src/widgets/cake_image_widget.dart"; |
| 3 | import "package:cw_core/currency_for_wallet_type.dart"; |
| 4 | import "package:flutter/material.dart"; |
| 5 | |
| 6 | class RecipientNetworkSelector extends StatelessWidget { |
| 7 | const RecipientNetworkSelector({ |
| 8 | required this.networkName, |
| 9 | required this.networkIconPath, |
| 10 | required this.onTap, |
| 11 | super.key, |
| 12 | }); |
| 13 | |
| 14 | final String networkName; |
| 15 | final String networkIconPath; |
| 16 | final VoidCallback onTap; |
| 17 | |
| 18 | @override |
| 19 | Widget build(BuildContext context) { |
| 20 | final colors = Theme.of(context).colorScheme; |
| 21 | return Semantics( |
| 22 | button: true, |
| 23 | label: "${S.of(context).network_prefix_on} $networkName", |
| 24 | child: GestureDetector( |
| 25 | onTap: onTap, |
| 26 | child: ExcludeSemantics( |
| 27 | child: Row( |
| 28 | mainAxisSize: MainAxisSize.min, |
| 29 | children: [ |
| 30 | Text( |
| 31 | S.of(context).network_prefix_on, |
| 32 | style: Theme.of(context) |
| 33 | .textTheme |
| 34 | .bodyMedium |
| 35 | ?.copyWith(color: colors.onSurfaceVariant, letterSpacing: -0.07), |
| 36 | ), |
| 37 | const SizedBox(width: 12), |
| 38 | CakeImageWidget( |
| 39 | imageUrl: networkIconPath, |
| 40 | width: 16, |
| 41 | height: 16, |
| 42 | fit: BoxFit.cover, |
| 43 | color: isMonochromeSymbolIcon(networkIconPath) ? colors.primary : null, |
| 44 | ), |
| 45 | const SizedBox(width: 8), |
| 46 | Text( |
| 47 | networkName, |
| 48 | style: Theme.of(context).textTheme.bodyMedium?.copyWith( |
| 49 | fontWeight: FontWeight.w400, |
| 50 | letterSpacing: -0.07, |
| 51 | color: colors.primary, |
| 52 | ), |
| 53 | ), |
| 54 | const SizedBox(width: 8), |
| 55 | Container( |
| 56 | width: 28, |
| 57 | height: 28, |
| 58 | decoration: BoxDecoration( |
| 59 | color: colors.surfaceContainer, |
| 60 | shape: BoxShape.circle, |
| 61 | ), |
| 62 | child: Icon( |
| 63 | Icons.keyboard_arrow_down, |
| 64 | size: 18, |
| 65 | color: colors.onSurfaceVariant, |
| 66 | ), |
| 67 | ), |
| 68 | ], |
| 69 | ), |
| 70 | ), |
| 71 | ), |
| 72 | ); |
| 73 | } |
| 74 | } |