diff --git a/cw_core/lib/wallet_type.dart b/cw_core/lib/wallet_type.dart index 10a472d60..7ef16d8ae 100644 --- a/cw_core/lib/wallet_type.dart +++ b/cw_core/lib/wallet_type.dart @@ -238,50 +238,51 @@ String walletTypeToString(WalletType type) { } } -String walletTypeToDisplayName(WalletType type) { - switch (type) { - case WalletType.monero: - return 'Monero (XMR)'; - case WalletType.bitcoin: - return 'Bitcoin (BTC)'; - case WalletType.litecoin: - return 'Litecoin (LTC)'; - case WalletType.haven: - return 'Haven (XHV)'; - case WalletType.ethereum: - return 'Ethereum (ETH)'; - case WalletType.bitcoinCash: - return 'Bitcoin Cash (BCH)'; - case WalletType.nano: - return 'Nano (XNO)'; - case WalletType.banano: - return 'Banano (BAN)'; - case WalletType.polygon: - return 'Polygon (POL)'; - case WalletType.solana: - return 'Solana (SOL)'; - case WalletType.tron: - return 'Tron (TRX)'; - case WalletType.wownero: - return 'Wownero (WOW)'; - case WalletType.zano: - return 'Zano (ZANO)'; - case WalletType.decred: - return 'Decred (DCR)'; - case WalletType.dogecoin: - return 'Dogecoin (DOGE)'; - case WalletType.base: - return 'Base'; - case WalletType.arbitrum: - return 'Arbitrum (ARB)'; - case WalletType.zcash: - return 'Zcash (ZEC)'; - case WalletType.bsc: - return 'BNB Smart Chain (BNB)'; - case WalletType.none: - return ''; - } -} +String walletTypeToDisplayName(WalletType type) => switch (type) { + WalletType.monero => 'Monero', + WalletType.bitcoin => 'Bitcoin', + WalletType.litecoin => 'Litecoin', + WalletType.haven => 'Haven', + WalletType.ethereum => 'Ethereum', + WalletType.bitcoinCash => 'Bitcoin Cash', + WalletType.nano => 'Nano', + WalletType.banano => 'Banano', + WalletType.polygon => 'Polygon', + WalletType.solana => 'Solana', + WalletType.tron => 'Tron', + WalletType.wownero => 'Wownero', + WalletType.zano => 'Zano', + WalletType.decred => 'Decred', + WalletType.dogecoin => 'Dogecoin', + WalletType.base => 'Base', + WalletType.arbitrum => 'Arbitrum', + WalletType.zcash => 'Zcash', + WalletType.bsc => 'BNB Smart Chain', + WalletType.none => '' + }; + +String walletTypeToDisplayTicker(WalletType type) => switch (type) { + WalletType.monero => 'XMR', + WalletType.bitcoin => 'BTC', + WalletType.litecoin => 'LTC', + WalletType.haven => 'XHV', + WalletType.ethereum => 'ETH', + WalletType.bitcoinCash => 'BCH', + WalletType.nano => 'XNO', + WalletType.banano => 'BAN', + WalletType.polygon => 'POL', + WalletType.solana => 'SOL', + WalletType.tron => 'TRX', + WalletType.wownero => 'WOW', + WalletType.zano => 'ZANO', + WalletType.decred => 'DCR', + WalletType.dogecoin => 'DOGE', + WalletType.base => '', + WalletType.arbitrum => 'ARB', + WalletType.zcash => 'ZEC', + WalletType.bsc => 'BNB', + WalletType.none => '' + }; WalletType? _cryptoCurrencyToWalletType(CryptoCurrency type) { switch (type) { diff --git a/cw_monero/pubspec.lock b/cw_monero/pubspec.lock index fc33c6fe8..2cd06b9d4 100644 --- a/cw_monero/pubspec.lock +++ b/cw_monero/pubspec.lock @@ -982,8 +982,8 @@ packages: dependency: "direct main" description: path: trezor-flutter - ref: "4bf54339a1caefd4c53a4a8873a9686ec13a9107" - resolved-ref: "4bf54339a1caefd4c53a4a8873a9686ec13a9107" + ref: becd18ac474d343d94b6191d89fad43270d2a02e + resolved-ref: becd18ac474d343d94b6191d89fad43270d2a02e url: "https://github.com/cake-tech/trezor-flutter.git" source: git version: "0.1.0" @@ -991,8 +991,8 @@ packages: dependency: transitive description: path: trezor_usb_transport - ref: "4bf54339a1caefd4c53a4a8873a9686ec13a9107" - resolved-ref: "4bf54339a1caefd4c53a4a8873a9686ec13a9107" + ref: becd18ac474d343d94b6191d89fad43270d2a02e + resolved-ref: becd18ac474d343d94b6191d89fad43270d2a02e url: "https://github.com/cake-tech/trezor-flutter.git" source: git version: "0.0.1" diff --git a/lib/new-ui/widgets/coins_page/assets_history/transaction_details_modal.dart b/lib/new-ui/widgets/coins_page/assets_history/transaction_details_modal.dart index 2eb692057..d81db4ac2 100644 --- a/lib/new-ui/widgets/coins_page/assets_history/transaction_details_modal.dart +++ b/lib/new-ui/widgets/coins_page/assets_history/transaction_details_modal.dart @@ -1,6 +1,7 @@ import 'package:cake_wallet/entities/new_ui_entities/list_item/list_item.dart'; import 'package:cake_wallet/entities/new_ui_entities/list_item/list_item_regular_row.dart'; import 'package:cake_wallet/generated/i18n.dart'; +import 'package:cake_wallet/new-ui/widgets/copy_wrapper.dart'; import 'package:cake_wallet/new-ui/widgets/receive_page/receive_top_bar.dart'; import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/src/screens/transaction_details/confirmations_list_item.dart'; @@ -81,9 +82,17 @@ class _TransactionDetailsModalState extends State { widget.transactionDetailsViewModel.formattedStatus, style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500), ), - Text( - widget.transactionDetailsViewModel.formattedCryptoAmount, - style: TextStyle(fontSize: 28), + CopyWrapper( + requireLongPress: true, + data: ClipboardData(text: widget.transactionDetailsViewModel.formattedCryptoAmount), + builder: (context, copied)=> AnimatedSwitcher( + duration: Duration(milliseconds: 300), + child: Text( + key: ValueKey(copied), + copied ? S.of(context).copied : widget.transactionDetailsViewModel.formattedCryptoAmount, + style: TextStyle(fontSize: 28, color: copied ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.onSurface), + ), + ), ), Padding( padding: const EdgeInsets.all(16.0), diff --git a/lib/new-ui/widgets/copy_wrapper.dart b/lib/new-ui/widgets/copy_wrapper.dart index 83ed13a47..587930664 100644 --- a/lib/new-ui/widgets/copy_wrapper.dart +++ b/lib/new-ui/widgets/copy_wrapper.dart @@ -9,12 +9,14 @@ class CopyWrapper extends StatefulWidget { const CopyWrapper( {super.key, this.data, + this.requireLongPress = false, this.isSensitive = false, required this.builder, this.duration = const Duration(milliseconds: 1200)}); final ClipboardData? data; final bool isSensitive; + final bool requireLongPress; final Widget Function(BuildContext, bool) builder; final Duration duration; @@ -40,7 +42,8 @@ class _CopyWrapperState extends State { Widget build(BuildContext context) { return GestureDetector( behavior: HitTestBehavior.translucent, - onTap: handleCopy, + onTap: widget.requireLongPress ? null : handleCopy, + onLongPress: !widget.requireLongPress ? null : handleCopy, child: widget.builder(context, copied), ); } diff --git a/lib/src/screens/new_wallet/new_wallet_type_page.dart b/lib/src/screens/new_wallet/new_wallet_type_page.dart index dee66e95b..7bcf3edf5 100644 --- a/lib/src/screens/new_wallet/new_wallet_type_page.dart +++ b/lib/src/screens/new_wallet/new_wallet_type_page.dart @@ -137,7 +137,7 @@ class WalletTypeFormState extends State { ), Flexible( child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 18), + padding: const EdgeInsets.only(left: 18, right: 18, bottom: 12), child: Container( decoration: BoxDecoration( color: Theme.of(context).colorScheme.surfaceContainer, @@ -172,10 +172,10 @@ class WalletTypeFormState extends State { imageUrl: curr.iconPath, ), const SizedBox(width: 12), - Text(curr.fullName ?? curr.name), + Text(walletTypeToDisplayName(item)), const SizedBox(width: 4), Text( - curr.title, + walletTypeToDisplayTicker(item), style: TextStyle( color: Theme.of(context).colorScheme.onSurfaceVariant, ),