StackPage class

Creates a page that can provide a stack of inner pages.

Usage:

  '/stack': (_) => StackPage(
        child: StackContainerPage(),
        defaultPath: 'one',
      ),

  '/stack/one': (_) => MaterialPage(child: StackPageOne()),
  '/stack/one/two': (_) => MaterialPage(child: StackPageTwo()),

Then within StackContainerPage you can show the stack like this:

  PageStackNavigator(stack: StackPage.of(context).stack)
Inheritance
Mixed in types

Constructors

StackPage({required Widget child, required String defaultPath, Page pageBuilder(Widget child) = _defaultPageBuilder})
Initializes the page with a list of child paths.
const

Properties

arguments Object?
The arguments passed to this route.
finalinherited
child Widget
The content to be shown in the Route created by this page.
final
defaultPath String
The initial path for the stack.
final
hashCode int
The hash code for this object.
no setterinherited
key LocalKey?
The key associated with this page.
finalinherited
name String?
The name of the route (e.g., "/settings").
finalinherited
pageBuilder Page Function(Widget child)
Optional function to customize the Page created for this route. If this is null, a MaterialPage is used.
final
redirectPath String
The path of a child route to redirect to.
no setteroverride
restorationId String?
Restoration ID to save and restore the state of the Route configured by this page.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

canUpdate(Page other) bool
Whether this page can be updated with the other page.
inherited
createRoute(BuildContext context) Route<void>
Creates the Route that corresponds to this page.
inherited
createState() PageState<StatefulPage>
Returns a state object for this page.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

of(BuildContext context) StackPageState
Retrieves the StackPageState from the closest StackPage ancestor.