I have used this Flutter: BottomNavigationBar rebuilds Page on change of tab
and this article https://medium.com/@theboringdeveloper/common-bottom-navigation-bar-flutter-e3693305d2d
Had fixed it a bit, and now I am able to prevent direct root pages from being rebuilt. If you are still interested in how you can prevent root pages rebuilt, you can look through the gits and ask a question.
Gist it self: https://gist.github.com/Turbozanik/2149b763a414a35a249cfdd5a170f44f
The question is how can I prevent a child page from rebuilt. Will clarify it a bit.
child1
|
toot1 root2 root3 root4
Here all the root pages will not be rebuilt, but the child page in the tab will be rebuilt, is there any way I can keep the whole tab from rebuilding instead of just the root pages.(SPOILER: The only way, I was able to keep root pages is by creating a static list of root pages. Gist line 15.)
UPDATE: I have tested the widget behaviour when its rebuilt, in my case it even don't change the scroll position, so I am fine even with rebuilted widget(have no idea how it works it somehow is rebuilt into exactly the same state it was before the rebuild) But I am still interested how can I prevent the rebuild.