Skip to content

Commit 5181a6d

Browse files
committed
Update navigator_observer.dart
1 parent ca3a64a commit 5181a6d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/src/helper/navigator_observer.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import 'dialog_proxy.dart';
99
class SmartNavigatorObserver extends NavigatorObserver {
1010
@override
1111
void didPush(Route<dynamic> route, Route<dynamic>? previousRoute) {
12-
DialogProxy.contextNavigator = navigator?.context;
1312
RouteRecord.curRoute = route;
1413
RouteRecord.instance.push(route, previousRoute);
14+
navigateChange();
1515
}
1616

1717
@override
@@ -34,7 +34,15 @@ class SmartNavigatorObserver extends NavigatorObserver {
3434
_removeDialog(route);
3535
}
3636

37+
void navigateChange() {
38+
final navigatorContext = navigator?.context;
39+
if (navigatorContext != null) {
40+
DialogProxy.contextNavigator = navigatorContext;
41+
}
42+
}
43+
3744
void _removeDialog(Route<dynamic>? route) {
45+
navigateChange();
3846
if (route == null) {
3947
return;
4048
}

0 commit comments

Comments
 (0)