PreviewStage class
A stage that raises a previewed page on a route over itself once it is on screen, and keeps it raised: how a pushed or sheet page is previewed alone, so its exit renders as it does live and the chrome it derives is the real one (RoutePresentation.pushed or the sheet's).
A preview is looked at, not walked out of. The raised page refuses every
pop that asks — its exit, a barrier tap, the system back — so they
leave it standing; a pop that takes it anyway (a drag past a sheet's
last detent, a direct Navigator.pop) raises it again rather than
leaving the stage bare. Routes raised over the page (a dialog, a menu)
still close. The raised page shows the stage's CURRENT child: when the
stage is rebuilt with a new one (a hot reload of the preview), the page
already standing takes it on the next frame.
Mount it as the home of the preview's navigator.
PreviewStage(route: (context, page) => PageRouteBuilder<void>(pageBuilder: (context, animation, secondary) => page), child: const Text('Details'))
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- PreviewStage
Constructors
-
PreviewStage({required Route<
void> route(BuildContext context, Widget page), required Widget child, Widget? under, Key? key}) -
Creates a PreviewStage.
const
Properties
- child → Widget
-
The previewed page.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
route
→ Route<
void> Function(BuildContext context, Widget page) -
Builds the route child is raised on — the system's push or sheet
route around
page.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- under → Widget?
-
What the page is raised over — the page beneath it in the app, e.g.
the root a sheet rises from; null stands it over a blank stage.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< PreviewStage> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited