ExpressivePreview class

One page previewed alone, in the platform's register (Android, the lab's default, or iOS) and the brightness asked for.

Everything it builds, its own app included, stands in the design kit's preview frame, so the page behaves in the frame's register and reads its brightness. The register's system bars are drawn over the page and published as its safe-area insets (turn them off with systemBars). The page stands in presentation's register: a root, a page pushed over under or a sheet raised over it, whose own exit (the derived back, a barrier tap, the system back) leaves it standing.

Rebuilt with a new child (a hot reload, a new render of the page), it keeps the page's state and focus.

ExpressivePreview(platform: PreviewPlatform.ios, presentation: RoutePresentation.pushed, child: const TripPage())
Inheritance

Constructors

ExpressivePreview({required Widget child, PreviewPlatform platform = PreviewPlatform.android, Brightness brightness = Brightness.light, ExpressiveThemeData? light, ExpressiveThemeData? dark, RoutePresentation presentation = RoutePresentation.root, bool drawer = false, Widget? under, bool device = false, bool systemBars = true, ExpressiveNavigationMode navigationMode = ExpressiveNavigationMode.gesture, DateTime? clock, Key? key})
A preview of child in the given platform and brightness.
const

Properties

brightness → Brightness
The brightness the page is previewed in.
final
child → Widget
The previewed page.
final
clock → DateTime?
The time the status bar shows, on a twelve-hour face without AM or PM as both platforms' bars show it; 12:30 when null. A page previewed on an injected clock passes that clock, so the bar and the page agree.
final
dark → ExpressiveThemeData?
The dark theme; null wears the default preset's.
final
device → bool
Whether the page is laid out at the register's PreviewDevice and scaled to fit the preview's box, rather than filling the box.
final
drawer → bool
With RoutePresentation.sheet, whether the sheet is the full-screen cover rather than the modal bottom sheet.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
light → ExpressiveThemeData?
The light theme; null wears the default preset's.
final
How the Android register's navigation bar is drawn; iOS always draws the home indicator.
final
platform → PreviewPlatform
The platform register: its behaviour, device and system bars apply inside the preview.
final
presentation → RoutePresentation
The register the page stands in: RoutePresentation.root (the default), RoutePresentation.pushed (raised on an ExpressivePage route) or RoutePresentation.sheet (raised on an ExpressiveSheetPage route).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
systemBars → bool
Whether the register's system bars are drawn and reserved.
final
under → Widget?
What a pushed or sheet page is raised over — the page beneath it in the app; null raises it over the bare ground.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<ExpressivePreview>
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

Static Methods

systemInsetsOf(PreviewPlatform platform, {ExpressiveNavigationMode mode = ExpressiveNavigationMode.gesture}) → EdgeInsets
The safe-area insets the platform's system bars take, the Android navigation bar drawn in mode: what a previewed page reads as MediaQuery.padding.