Flutter : keeping list view index while changing Page View
A really annoying issue that I recently found when working with lists in flutter, is that in some cases, you will loose the current scroll position.
Maybe my issue is similar to https://github.com/flutter/flutter/issues/8101 but still, is not working after they fixed it.
In my case, I had to show a page view, with some bottom navigation widget under.
How it looks:
The code that generates the above UI:
The same issue was reported on stackoverflow and Marcin Szałek came with a solution, that I modified a little bit to be more generic, and be able to reuse in many places, creating a StatefulListView
And in the end, the final code that will save the list position: