0% found this document useful (0 votes)
1 views

Week-8-Routing-and-Navigation.docx

Flutter offers a navigation system for transitioning between screens and managing deep links, utilizing the Navigator for simple apps and the Router for more complex requirements. Deep linking allows users to access specific content directly within an app, enhancing user experience. Developers can pass parameters between screens by declaring them and accessing them through the widget syntax.

Uploaded by

YEJ XIM
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Week-8-Routing-and-Navigation.docx

Flutter offers a navigation system for transitioning between screens and managing deep links, utilizing the Navigator for simple apps and the Router for more complex requirements. Deep linking allows users to access specific content directly within an app, enhancing user experience. Developers can pass parameters between screens by declaring them and accessing them through the widget syntax.

Uploaded by

YEJ XIM
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Week 8-Routing and Navigating

Flutter provides a complete system for navigating between screens and handling deep links. Small
applications without complex deep linking can use Navigator, while apps with specific deep linking and
navigation requirements should also use the Router to correctly handle deep links on Android and iOS,
and to stay in sync with the address bar when the app is running on the web.

Deep linking refers to using a link to direct users to a specific location within a mobile app, rather than
just the app's homepage. It's like a shortcut that takes users directly to the content they're interested in,
instead of making them navigate through the app itself.

Using the Navigator

The Navigator widget displays screens as a stack using the correct transition animations for the target
platform. To navigate to a new screen, access the Navigator through the route's BuildContext and call
imperative methods such as push() or pop():
Because Navigator keeps a stack of Route objects (representing the history stack), The push() method
also takes a Route object. The MaterialPageRoute object is a subclass of Route that specifies the
transition animations for Material Design.

Using named routes

Applications with simple navigation and deep linking requirements can use the Navigator for navigation
and the MaterialApp.routes parameter for deep links:
Using the Router

Flutter applications with advanced navigation and routing requirements (such as a web app that uses
direct links to each screen, or an app with multiple Navigator widgets) should use a routing package such
as go_router that can parse the route path and configure the Navigator whenever the app receives a new
deep link.

To use the Router, switch to the router constructor on MaterialApp or CupertinoApp and provide it with
a Router configuration.

Full Code of the application

Homepage.dart
Secondpage.dart
Passing of parameters/arguments between Screens

Step 1: Declare the parameters/arguments of the screen

Step 2: Use the declared variables. To call these variables, use the syntax “widget.<variable name>”. E.g
“widget.message”
Step 3: Provide the required arguments on the screen

You might also like