0
votes

I am trying to understand the standard practice of using the BottomNavigationBar for navigating/rendering in Flutter. I've been looking at examples and have seen multiple ways of doing this.

  1. When a tab is selected do a setstate and render the body.
  2. When a tab is selected use navigator to navigate to a new screen/page while persisting the BottomNavigationBar

Which is the right thing to do or it depends?

1

1 Answers

1
votes

It depends on what you want to achieve.

If you render a new page (with navigate) the page will slide in from right or from wherever you want and you can add a back button to go back to the previous page.

If you use setState to render new content the content will just be replaced. Therefore it's a completely different user experience.

With a ButtomNavigationBar I suggest to use setState, to just replace the content. This is the usual behavior of a ButtomNavigationBar