diff --git a/lib/app/features/wallet/views/pages/coins_flow/coin_details/components/balance/balance.dart b/lib/app/features/wallet/views/pages/coins_flow/coin_details/components/balance/balance.dart index 74807dc71..57310b594 100644 --- a/lib/app/features/wallet/views/pages/coins_flow/coin_details/components/balance/balance.dart +++ b/lib/app/features/wallet/views/pages/coins_flow/coin_details/components/balance/balance.dart @@ -9,7 +9,6 @@ import 'package:ion/app/extensions/num.dart'; import 'package:ion/app/extensions/theme_data.dart'; import 'package:ion/app/features/wallet/model/coin_data.c.dart'; import 'package:ion/app/features/wallet/model/network_type.dart'; -import 'package:ion/app/features/wallet/views/pages/coins_flow/coin_receive_modal/model/coin_receive_modal_data.c.dart'; import 'package:ion/app/features/wallet/views/pages/coins_flow/providers/send_asset_form_provider.c.dart'; import 'package:ion/app/features/wallet/views/pages/coins_flow/receive_coins/providers/receive_coins_form_provider.c.dart'; import 'package:ion/app/features/wallet/views/pages/wallet_page/components/balance/balance_actions.dart'; @@ -67,14 +66,11 @@ class Balance extends ConsumerWidget { padding: EdgeInsets.only(bottom: 20.0.s, top: 11.0.s), child: BalanceActions( onReceive: () { - ref.read(receiveCoinsFormControllerProvider.notifier).setNetwork(networkType); + ref.read(receiveCoinsFormControllerProvider.notifier) + ..setCoin(coinData) + ..setNetwork(networkType); - CoinReceiveRoute( - $extra: CoinReceiveModalData( - coinData: coinData, - networkType: networkType, - ), - ).push(context); + CoinReceiveRoute().push(context); }, onSend: () { ref.read(sendAssetFormControllerProvider().notifier).setCoin(coinData); diff --git a/lib/app/features/wallet/views/pages/coins_flow/coin_receive_modal/coin_receive_modal.dart b/lib/app/features/wallet/views/pages/coins_flow/coin_receive_modal/coin_receive_modal.dart index cd8a8a78d..03cc78234 100644 --- a/lib/app/features/wallet/views/pages/coins_flow/coin_receive_modal/coin_receive_modal.dart +++ b/lib/app/features/wallet/views/pages/coins_flow/coin_receive_modal/coin_receive_modal.dart @@ -1,7 +1,6 @@ // SPDX-License-Identifier: ice License 1.0 import 'package:flutter/material.dart'; -import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:ion/app/components/list_item/list_item.dart'; import 'package:ion/app/components/screen_offset/screen_bottom_offset.dart'; @@ -12,7 +11,6 @@ import 'package:ion/app/extensions/num.dart'; import 'package:ion/app/extensions/theme_data.dart'; import 'package:ion/app/features/wallet/model/network_type.dart'; import 'package:ion/app/features/wallet/views/pages/coins_flow/coin_receive_modal/components/coin_address_tile/coin_address_tile.dart'; -import 'package:ion/app/features/wallet/views/pages/coins_flow/coin_receive_modal/model/coin_receive_modal_data.c.dart'; import 'package:ion/app/features/wallet/views/pages/coins_flow/receive_coins/providers/receive_coins_form_provider.c.dart'; import 'package:ion/app/hooks/use_on_init.dart'; import 'package:ion/app/router/app_routes.c.dart'; @@ -21,22 +19,19 @@ import 'package:ion/app/router/components/navigation_app_bar/navigation_close_bu import 'package:ion/app/router/components/sheet_content/sheet_content.dart'; class CoinReceiveModal extends HookConsumerWidget { - const CoinReceiveModal({required this.payload, super.key}); - - final CoinReceiveModalData payload; + const CoinReceiveModal({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { - final networkType = useState(payload.networkType); + final receiveCoinState = ref.watch(receiveCoinsFormControllerProvider); void updateNetwork(NetworkType network) { - networkType.value = network == NetworkType.all ? NetworkType.arbitrum : network; - ref.read(receiveCoinsFormControllerProvider.notifier).setNetwork(networkType.value); + final clarifiedNetwork = network == NetworkType.all ? NetworkType.arbitrum : network; + ref.read(receiveCoinsFormControllerProvider.notifier).setNetwork(clarifiedNetwork); } useOnInit( - () => updateNetwork(payload.networkType), - [payload], + () => updateNetwork(receiveCoinState.selectedNetwork), ); return SheetContent( @@ -53,7 +48,7 @@ class CoinReceiveModal extends HookConsumerWidget { ), ScreenSideOffset.small( child: CoinAddressTile( - coinData: payload.coinData, + coinData: receiveCoinState.selectedCoin, ), ), SizedBox( @@ -62,9 +57,9 @@ class CoinReceiveModal extends HookConsumerWidget { ScreenSideOffset.small( child: ListItem( title: Text(context.i18n.wallet_network), - subtitle: Text(networkType.value.getDisplayName(context)), + subtitle: Text(receiveCoinState.selectedNetwork.getDisplayName(context)), switchTitleStyles: true, - leading: networkType.value.iconAsset.icon(size: 36.0.s), + leading: receiveCoinState.selectedNetwork.iconAsset.icon(size: 36.0.s), trailing: Text( context.i18n.wallet_change, style: context.theme.appTextThemes.caption.copyWith( diff --git a/lib/app/router/wallet_routes.dart b/lib/app/router/wallet_routes.dart index b46d266fc..d1fa82601 100644 --- a/lib/app/router/wallet_routes.dart +++ b/lib/app/router/wallet_routes.dart @@ -272,13 +272,11 @@ class CoinsDetailsRoute extends BaseRouteData { } class CoinReceiveRoute extends BaseRouteData { - CoinReceiveRoute({required this.$extra}) + CoinReceiveRoute() : super( - child: CoinReceiveModal(payload: $extra), + child: const CoinReceiveModal(), type: IceRouteType.bottomSheet, ); - - final CoinReceiveModalData $extra; } class ManageCoinsRoute extends BaseRouteData {