mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-12 08:53:57 +01:00
* feat: Add network selector and compatible networks screen to send page for EVMs * feat: add redesigned payanything flow and handle cases for evms, solana and tron * feat: adding the swap part to the entire flow * refactor: update navigation and error handling in send and swap flows * adjust structuring and use the chain badge icons, also fix crypto and currency values not consistent on single network picker * fix: modify guard for non-evm chains and minor cleanup * use multipicker layout for receive section, streamline send to available balances and adjust colors as needed * handle btc case for picker, update style and images across * fix all pending issues with scanning qr and network handling for both evm and non evm, plus token and amount resolving * fix all pending issues with scanning qr and network handling for both evm and non evm, plus token and amount resolving * fix: expand fetch for tokens across networks and fix other issues regarding scanning from homepage * auto-reformat * fix conflict * handle evm qr scan from homepage and add guards for swap and switch flows * chore: Cleanup * chore: set estimated fee to 0 when switching wallet * fix merge conflicts * fix to review comments and reformatting for lints * fix: root cause for token bug reported * chore: cleanup * feat: add improved anypay swap screen which focuses on the receive amount fix: fiat input toggle erro (also present on prod) reformat: anypay related widgets * feat: add alert for unsupported networks in payment requests * fix: prevent rate and provider from showing until amount is calculated and loaded fix: remove send icon in rate widget and align to center fix: adjust network badge in swap confirm widget * feat: embed tokens for solana and tron in QR generated for swap from external * test: add unit tests for Tron, Solana, and ERC681 URI handling and detection * fix: review comments * fix: handle more edgecases * feat: enhance ERC681URI to support raw token amounts and decimals * refactor: streamline EVM chain ID retrieval in send page and recipient network row * fix: minor review comments --------- Co-authored-by: Robert Malikowski <malikowskirobert@gmail.com>
109 lines
3.8 KiB
Dart
109 lines
3.8 KiB
Dart
import "package:cake_wallet/generated/i18n.dart";
|
|
import "package:cake_wallet/new-ui/widgets/receive_page/receive_top_bar.dart";
|
|
import "package:cake_wallet/new-ui/widgets/send_page/l2_action_wallet_selector.dart";
|
|
import "package:cake_wallet/src/widgets/cake_image_widget.dart";
|
|
import "package:cw_core/currency_for_wallet_type.dart";
|
|
import "package:cw_core/wallet_info.dart";
|
|
import "package:flutter/cupertino.dart";
|
|
import "package:flutter/material.dart";
|
|
|
|
class SwitchNetworkWalletPage extends StatelessWidget {
|
|
const SwitchNetworkWalletPage({
|
|
required this.wallets,
|
|
required this.networkName,
|
|
required this.destinationIconPath,
|
|
super.key,
|
|
});
|
|
|
|
final String networkName;
|
|
final String destinationIconPath;
|
|
final List<WalletInfo> wallets;
|
|
|
|
static Future<WalletInfo?> push({
|
|
required BuildContext context,
|
|
required String networkName,
|
|
required String targetIconPath,
|
|
required List<WalletInfo> wallets,
|
|
}) =>
|
|
Navigator.of(context).push<WalletInfo>(
|
|
CupertinoPageRoute(
|
|
builder: (_) => SwitchNetworkWalletPage(
|
|
networkName: networkName,
|
|
destinationIconPath: targetIconPath,
|
|
wallets: wallets,
|
|
),
|
|
),
|
|
);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final colors = Theme.of(context).colorScheme;
|
|
return Material(
|
|
color: colors.surface,
|
|
child: SafeArea(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
ModalTopBar(
|
|
title: "",
|
|
leadingIcon: const Icon(Icons.arrow_back_ios_new),
|
|
leadingSemanticLabel: S.of(context).seed_alert_back,
|
|
onLeadingPressed: () => Navigator.of(context).maybePop(),
|
|
),
|
|
const SizedBox(height: 124),
|
|
Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Icon(Icons.arrow_forward, color: colors.primary, size: 32),
|
|
const SizedBox(width: 8),
|
|
CakeImageWidget(
|
|
imageUrl: destinationIconPath,
|
|
width: 50,
|
|
height: 50,
|
|
fit: BoxFit.contain,
|
|
color: isMonochromeSymbolIcon(destinationIconPath) ? colors.primary : null,
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 24),
|
|
Text(
|
|
S.of(context).switch_to_x_wallet(networkName),
|
|
textAlign: TextAlign.center,
|
|
style: Theme.of(context)
|
|
.textTheme
|
|
.titleLarge
|
|
?.copyWith(fontSize: 20, fontWeight: FontWeight.w500, letterSpacing: -0.1),
|
|
),
|
|
const SizedBox(height: 24),
|
|
Text(
|
|
S.of(context).select_compatible_wallet,
|
|
textAlign: TextAlign.center,
|
|
style: Theme.of(context)
|
|
.textTheme
|
|
.bodyMedium
|
|
?.copyWith(color: colors.onSurfaceVariant, letterSpacing: -0.07),
|
|
),
|
|
const SizedBox(height: 24),
|
|
Expanded(
|
|
child: ListView.separated(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
itemCount: wallets.length,
|
|
separatorBuilder: (_, __) => const SizedBox(height: 12),
|
|
itemBuilder: (_, index) {
|
|
final wallet = wallets[index];
|
|
return WalletRow(
|
|
currencyIconPath: getCryptoCurrencyIconForWalletListItem(wallet.type),
|
|
walletName: wallet.name,
|
|
onTap: () => Navigator.of(context).pop(wallet),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|