Flutter Navigation to a new screen and back:
In most of the times we opens several screens for displaying different types of information. For example, we might have a screen that shows products list. Our users could then tap on a single product to get more information about it on a new screen.
In Android we call them as new Activities. In iOS terms we call it as, new ViewControllers. In Flutter terms we call them, screens are just Widgets!
Using Navigation’s in Flutter:
- Create two screens
- Navigate to the second screen using
- Return to the first screen using
Create two screens:
This is a simple basic example, we’ll create two screens, each having a single button. Tapping the button on the first screen will navigate to the second screen. Tapping the button on the second screen will return our user back to the first screen!
Below is the sample code to create two simple screens: