The app I am developing attempts to adopt, as much as possible, the most native experience for Android & iOS users.
To do so, the app runs a CupertinoApp
and a MaterialApp
.
On iOS, I use the CupertinoScaffold
showing a CupertinoTabBar
with BottomNavigationBarItems
. It performs very well as expected:
- pages are created only once, the first time I click on a tab;
- pages are restored when returning to a previously displayed tab: in one of my tab, there is a list and its scroll position is always maintained, persisted.
on Android, the story is different: I am using the Drawer
widget.
When I click on an entry, I call Navigator#push
to show the associated page. However, this will keep adding new instances of each entry's page in the stack.
I don't seem to be able to return to an existing page. At least, not how I can do it with iOS.
Looking at the Navigator
I see functions that seem to achieve what I am looking for:
popUntil
=> will show my existing screen, but at the expanses of all the other ones that will therefore make a sacrifice for the sake of just one page. So much ado for nothing...pushReplacement
=> will show a new instance of the target page and destroy the current one. Not desirable.
What am I missing ? How can I achieve that the CupertinoTabBar
seems to be able to do?