Many apps have a navigator near the top of their widget hierarchy in orderto display their logical history using an Overlay with the most recentlyvisited pages visually on top of the older pages. Using this pattern letsthe navigator visually transition from one page to another by moving the widgetsaround in the overlay. Similarly, the navigator can be used to show a dialogby positioning the dialog widget above the current page.
The Navigator will convert its Navigator.pages into a stack of Routesif it is provided. A change in Navigator.pages will trigger an update tothe stack of Routes. The Navigator will update its routes to match thenew configuration of its Navigator.pages. To use this API, one can createa Page subclass and defines a list of Pages for Navigator.pages. ANavigator.onPopPage callback is also required to properly clean up theinput pages in case of a pop.
By Default, the Navigator will use DefaultTransitionDelegate to decidehow routes transition in or out of the screen. To customize it, define aTransitionDelegate subclass and provide it to theNavigator.transitionDelegate.
Mobile apps typically reveal their contents via full-screen elementscalled "screens" or "pages". In Flutter these elements are calledroutes and they're managed by a Navigator widget. The navigatormanages a stack of Route objects and provides two ways for managingthe stack, the declarative API Navigator.pages or imperative APINavigator.push and Navigator.pop.
When your user interface fits this paradigm of a stack, where the usershould be able to navigate back to an earlier element in the stack,the use of routes and the Navigator is appropriate. On certain platforms,such as Android, the system UI will provide a back button (outside thebounds of your application) that will allow the user to navigate backto earlier routes in your application's stack. On platforms that don'thave this build-in navigation mechanism, the use of an AppBar (typicallyused in the Scaffold.appBar property) can automatically add a backbutton for user navigation.
Although you can create a navigator directly, it's most common to use thenavigator created by the Router which itself is created and configured bya WidgetsApp or a MaterialApp widget. You can refer to that navigatorwith Navigator.of.
It usually isn't necessary to provide a widget that pops the Navigatorin a route with a Scaffold because the Scaffold automatically adds a'back' button to its AppBar. Pressing the back button causesNavigator.pop to be called. On Android, pressing the system backbutton does the same thing.
Mobile apps often manage a large number of routes and it's ofteneasiest to refer to them by name. Route names, by convention,use a path-like structure (for example, '/a/b/c').The app's home page route is named '/' by default.
The MaterialApp can be createdwith a Map which maps from a route's name toa builder function that will create it. The MaterialApp uses thismap to create a value for its navigator's onGenerateRoute callback.
When a route is used to return a value, the route's type parameter mustmatch the type of pop's result. That's why we've usedMaterialPageRoute instead of MaterialPageRoute or justMaterialPageRoute. (If you prefer to not specify the types, though, that'sfine too.)
Routes don't have to obscure the entire screen. PopupRoutes cover thescreen with a ModalRoute.barrierColor that can be only partially opaque toallow the current screen to show through. Popup routes are "modal" becausethey block input to the widgets below.
There are functions which create and show popup routes. Forexample: showDialog, showMenu, and showModalBottomSheet. Thesefunctions return their pushed route's Future as described above.Callers can await the returned value to take an action when theroute is popped, or to discover the route's value.
There are also widgets which create popup routes, like PopupMenuButton andDropdownButton. These widgets create internal subclasses of PopupRouteand use the Navigator's push and pop methods to show and dismiss them.
You can create your own subclass of one of the widget library route classeslike PopupRoute, ModalRoute, or PageRoute, to control the animatedtransition employed to show the route, the color and behavior of the route'smodal barrier, and other aspects of the route.
The PageRouteBuilder class makes it possible to define a custom routein terms of callbacks. Here's an example that rotates and fades its childwhen the route appears or disappears. This route does not obscure the entirescreen because it specifies opaque: false, just as a popup route does.
The page route is built in two parts, the "page" and the"transitions". The page becomes a descendant of the child passed tothe transitionsBuilder function. Typically the page is only built once,because it doesn't depend on its animation parameters (elided with _and __ in this example). The transition is built on every framefor its duration.
An app can use more than one Navigator. Nesting one Navigator belowanother Navigator can be used to create an "inner journey" such as tabbednavigation, user registration, store checkout, or other independent journeysthat represent a subsection of your overall application.
In addition to the parallel navigation of the tabs, it is still possible tolaunch full-screen pages that completely cover the tabs. For example: anon-boarding flow, or an alert dialog. Therefore, there must exist a "root"Navigator that sits above the tab navigation. As a result, each of thetab's Navigators are actually nested Navigators sitting below a singleroot Navigator.
Run this example with flutter run --route=/signup to start it withthe signup flow instead of on the home page. link To create a local project with this code sample, run:
flutter create --sample=widgets.Navigator.1 mysample
Navigator.of operates on the nearest ancestor Navigator from the givenBuildContext. Be sure to provide a BuildContext below the intendedNavigator, especially in large build methods where nested Navigatorsare created. The Builder widget can be used to access a BuildContext ata desired location in the widget subtree.
In the common case of a modal route, the enclosing route can be obtainedfrom inside a build method using ModalRoute.of. To determine if theenclosing route is the active route (e.g. so that controls can be dimmedwhen the route is not active), the Route.isCurrent property can be checkedon the returned route.
If provided with a restorationScopeId and when surrounded by a validRestorationScope the Navigator will restore its state by recreatingthe current history stack of Routes during state restoration and byrestoring the internal state of those Routes. However, not all Routeson the stack can be restored:
If a Route is deemed restorable, the Navigator will set itsRoute.restorationScopeId to a non-null value. Routes can use that ID tostore and restore their own state. As an example, the ModalRoute willuse this ID to create a RestorationScope for its content widgets.
A navigator is the person on board a ship or aircraft responsible for its navigation.[1] The navigator's primary responsibility is to be aware of ship or aircraft position at all times. Responsibilities include planning the journey, advising the ship's captain or aircraft commander of estimated timing to destinations while en route, and ensuring hazards are avoided. The navigator is in charge of maintaining the aircraft or ship's nautical charts, nautical publications, and navigational equipment, and they generally have responsibility for meteorological equipment and communications.With the advent of satellite navigation, the effort required to accurately determine one's position has decreased by orders of magnitude, so the entire field has experienced a revolutionary transition since the 1990s with traditional navigation tasks, like performing celestial navigation, being used less frequently. Using multiple independent position fix methods without solely relying on electronic systems subject to failure helps the navigator detect errors. Professional mariners are still proficient in traditional piloting and celestial navigation.
Shipborne navigators in the U.S. Navy are normally surface warfare officer qualified with the exception of naval aviators and naval flight officers assigned to ship's navigator billets aboard aircraft carriers and large deck amphibious assault ships and who have been qualified at a level equal to surface warfare officers. U.S. Coast Guard officers that are shipboard navigators are normally cutter qualified at a level analogous to the USN officers previously mentioned. Quartermasters are the navigator's enlisted assistants and perform most of the technical navigation duties.
Navigators are sometimes also called 'air navigators' or 'flight navigators'. In civil aviation this was a position on older aircraft, typically between the late-1910s and the 1970s, where separate crew members (sometimes two navigation crew members) were often responsible for an aircraft's flight navigation, including its dead reckoning and celestial navigation, especially when flown over oceans or other large featureless areas where radio navigation aids were not originally available. As sophisticated electronic air navigation aids and universal space-based GPS navigation systems came online, the dedicated Navigator's position was discontinued and its function was assumed by dual-licensed Pilot-Navigators, and still later by the aircraft's primary pilots (Captain and FO), resulting in a continued downsizing in the number of aircrew positions on commercial flights. Modern electronic navigation systems made the civil aviation navigators redundant by the early 1980s.[1]
In military aviation, navigators are still actively trained and licensed in some present day air forces, as electronic navigation aids cannot be assumed to be operational during wartime. In the world's air forces, modern navigators are frequently tasked with weapons and defensive systems operations, along with co-pilot duties such as flight planning and fuel management, depending on the type, model and series of aircraft.[2] In the U.S. Air Force, the aeronautical rating of navigator has been augmented by addition of the combat systems officer, while in the U.S. Navy and U.S. Marine Corps, those officers formerly called navigators, tactical systems officers, or naval aviation observers have been known as naval flight officers since the mid-1960s. USAF navigators/combat systems officers and USN/USMC naval flight officers must be basic mission qualified in their aircraft, or fly with an instructor navigator or instructor NFO to provide the necessary training for their duties.
b1e95dc632