You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow depending on ModalRoute.popDispositionOf(context) #162009
I want to implement a custom widget that can close the current route using a gesture. One of my requirements is that the gesture is not accepted, if the current route can't be popped using a gesture (aka its popDisposition is .doNotPop).
Unfortunately, I found no way to keep my widget updated, since depending on ModalRoute.of(context) doesn't trigger a rebuild when the popDisposition changes, and its Notifications bubble upwards, so the route's contents can't receive them.
Proposal
Add popDisposition as an aspect to the respective InheritedModel so that we can depend on it reliably.
Hi @maRci002, thanks for the swift response! I don't think this is a viable solution, since Notifications only bubble upwards, while I want to know the route's popDisposition from it's subtree (any widget that's part of a route's content).
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
maRci002 commentedon Jan 23, 2025
You can create your own
NotificationListener<NavigationNotification>. Here is an example from the framework:flutter/packages/flutter/lib/src/widgets/navigator.dart
Lines 5866 to 5880 in 9ded795
timcreatedit commentedon Jan 23, 2025
Hi @maRci002, thanks for the swift response! I don't think this is a viable solution, since
Notifications only bubble upwards, while I want to know the route'spopDispositionfrom it's subtree (any widget that's part of a route's content).Let me know if I'm misunderstanding something.
Feat: Add opaque, isActive, isFirst, popDisposition aspects for Modal…
Feat: Add opaque, isActive, isFirst, popDisposition aspects for Modal…
github-actions commentedon Jun 12, 2025
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.