@@ -83,10 +83,24 @@ class _ConfirmChangeNowSendViewState
8383 final coin = wallet.info.coin;
8484
8585 final sendProgressController = ProgressAndSuccessController ();
86+ var isSendingDialogOpen = false ;
8687
88+ void closeSendingDialog () {
89+ if (! context.mounted || ! isSendingDialogOpen) {
90+ return ;
91+ }
92+ final rootNavigator = Navigator .of (context, rootNavigator: true );
93+ if (rootNavigator.canPop ()) {
94+ rootNavigator.pop ();
95+ }
96+ isSendingDialogOpen = false ;
97+ }
98+
99+ isSendingDialogOpen = true ;
87100 unawaited (
88101 showDialog <void >(
89102 context: context,
103+ useRootNavigator: true ,
90104 useSafeArea: false ,
91105 barrierDismissible: false ,
92106 builder: (context) {
@@ -95,7 +109,7 @@ class _ConfirmChangeNowSendViewState
95109 controller: sendProgressController,
96110 );
97111 },
98- ),
112+ ). whenComplete (() => isSendingDialogOpen = false ) ,
99113 );
100114
101115 final time = Future <dynamic >.delayed (const Duration (milliseconds: 2500 ));
@@ -141,10 +155,8 @@ class _ConfirmChangeNowSendViewState
141155
142156 // pop back to wallet
143157 if (context.mounted) {
158+ closeSendingDialog ();
144159 if (Util .isDesktop) {
145- // pop sending dialog
146- Navigator .of (context, rootNavigator: true ).pop ();
147-
148160 // one day we'll do routing right
149161 Navigator .of (context, rootNavigator: true ).pop ();
150162 if (widget.fromDesktopStep4) {
@@ -162,7 +174,7 @@ class _ConfirmChangeNowSendViewState
162174 );
163175
164176 // pop sending dialog
165- Navigator . of (context). pop ();
177+ closeSendingDialog ();
166178
167179 await showDialog <dynamic >(
168180 context: context,
0 commit comments