Skip to content

Commit

Permalink
Fixes #1232
Browse files Browse the repository at this point in the history
  • Loading branch information
erdemyerebasmaz committed Oct 17, 2023
1 parent 43fa7f2 commit a850fb1
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions lib/routes/transfer_funds_in_progress_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,26 @@ class _TransferFundsInProgressDialog extends StatefulWidget {
class _TransferFundsInProgressDialogState
extends State<_TransferFundsInProgressDialog> {
StreamSubscription<AccountModel> _stateSubscription;
ModalRoute _currentRoute;

@override
void initState() {
super.initState();
_stateSubscription = widget.accountStream.listen((state) {
if (state.transferringOnChainDeposit != true) {
_pop();
if (state.transferringOnChainDeposit != true && _currentRoute.isActive) {
Navigator.of(context).removeRoute(_currentRoute);
}
}, onError: (err) => _pop());
}, onError: (err) {
if (_currentRoute.isActive) {
Navigator.of(context).removeRoute(_currentRoute);
}
});
}

@override
void didChangeDependencies() {
super.didChangeDependencies();
_currentRoute ??= ModalRoute.of(context);
}

@override
Expand All @@ -46,13 +57,10 @@ class _TransferFundsInProgressDialogState
super.dispose();
}

_pop() {
Navigator.of(context).pop();
}

@override
Widget build(BuildContext context) {
final texts = context.texts();

return createAnimatedLoaderDialog(
context,
texts.transferring_funds_title,
Expand Down

0 comments on commit a850fb1

Please sign in to comment.