From a8b0901ec664e9f1bee21222cd5d4e319e92aeff Mon Sep 17 00:00:00 2001 From: julian Date: Tue, 22 Nov 2022 15:32:06 -0600 Subject: [PATCH] desktop exchange navigation flow fix --- lib/pages/exchange_view/confirm_change_now_send.dart | 12 ++++++++++++ lib/pages/exchange_view/send_from_view.dart | 6 ++++++ .../exchange_steps/subwidgets/desktop_step_4.dart | 1 + 3 files changed, 19 insertions(+) diff --git a/lib/pages/exchange_view/confirm_change_now_send.dart b/lib/pages/exchange_view/confirm_change_now_send.dart index 9f62bd8ec..540067915 100644 --- a/lib/pages/exchange_view/confirm_change_now_send.dart +++ b/lib/pages/exchange_view/confirm_change_now_send.dart @@ -37,6 +37,7 @@ class ConfirmChangeNowSendView extends ConsumerStatefulWidget { this.routeOnSuccessName = WalletView.routeName, required this.trade, this.shouldSendPublicFiroFunds, + this.fromDesktopStep4 = false, }) : super(key: key); static const String routeName = "/confirmChangeNowSend"; @@ -46,6 +47,7 @@ class ConfirmChangeNowSendView extends ConsumerStatefulWidget { final String routeOnSuccessName; final Trade trade; final bool? shouldSendPublicFiroFunds; + final bool fromDesktopStep4; @override ConsumerState createState() => @@ -105,7 +107,17 @@ class _ConfirmChangeNowSendViewState if (mounted) { if (Util.isDesktop) { Navigator.of(context, rootNavigator: true).pop(); + + // stupid hack + if (widget.fromDesktopStep4) { + Navigator.of(context, rootNavigator: true).pop(); + Navigator.of(context, rootNavigator: true).pop(); + Navigator.of(context, rootNavigator: true).pop(); + Navigator.of(context, rootNavigator: true).pop(); + Navigator.of(context, rootNavigator: true).pop(); + } } + Navigator.of(context).popUntil(ModalRoute.withName(routeOnSuccessName)); } } catch (e) { diff --git a/lib/pages/exchange_view/send_from_view.dart b/lib/pages/exchange_view/send_from_view.dart index 7cbf38384..7c5f5541c 100644 --- a/lib/pages/exchange_view/send_from_view.dart +++ b/lib/pages/exchange_view/send_from_view.dart @@ -38,6 +38,7 @@ class SendFromView extends ConsumerStatefulWidget { required this.amount, required this.address, this.shouldPopRoot = false, + this.fromDesktopStep4 = false, }) : super(key: key); static const String routeName = "/sendFrom"; @@ -47,6 +48,7 @@ class SendFromView extends ConsumerStatefulWidget { final String address; final Trade trade; final bool shouldPopRoot; + final bool fromDesktopStep4; @override ConsumerState createState() => _SendFromViewState(); @@ -191,6 +193,7 @@ class _SendFromViewState extends ConsumerState { amount: amount, address: address, trade: trade, + fromDesktopStep4: widget.fromDesktopStep4, ), ); }, @@ -210,12 +213,14 @@ class SendFromCard extends ConsumerStatefulWidget { required this.amount, required this.address, required this.trade, + this.fromDesktopStep4 = false, }) : super(key: key); final String walletId; final Decimal amount; final String address; final Trade trade; + final bool fromDesktopStep4; @override ConsumerState createState() => _SendFromCardState(); @@ -323,6 +328,7 @@ class _SendFromCardState extends ConsumerState { : HomeView.routeName, trade: trade, shouldSendPublicFiroFunds: shouldSendPublicFiroFunds, + fromDesktopStep4: widget.fromDesktopStep4, ), settings: const RouteSettings( name: ConfirmChangeNowSendView.routeName, diff --git a/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_4.dart b/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_4.dart index c86713a76..5b69f064d 100644 --- a/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_4.dart +++ b/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_4.dart @@ -224,6 +224,7 @@ class _DesktopStep4State extends ConsumerState { amount: amount, address: address, shouldPopRoot: true, + fromDesktopStep4: true, ), const RouteSettings( name: SendFromView.routeName,