-
Notifications
You must be signed in to change notification settings - Fork 87
Open
Labels
enhancementNew feature or requestNew feature or request
Description
What feature would you like to see?
As mentioned in #252, pages are currently disposed when navigating away from them — and along with that, their scroll positions are lost too.
It seems like this could eventually be solved once there’s a way to prevent pages from being disposed on navigation. In the meantime, since the package already keeps a ScrollController for each page (unless the user provides their own), would it be possible to add something to persist scroll positions when navigating away and back?
For now, I’ve worked around this with a pretty hacky setup:
final offsetNotifier = ValueNotifier<double>(0);
final scrollController = ScrollController(
onAttach: (position) {
SchedulerBinding.instance.addPostFrameCallback((_) {
position.jumpTo(offsetNotifier.value);
});
},
onDetach: (position) {
offsetNotifier.value = position.pixels;
},
);I just pass that controller to the page to manually keep the scroll position between navigations.
Current behaviour:
wolt.mp4
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request