PreviewAxes class abstract
The app-wide switches a project's shell offers — a theme, a locale, a flavour — drawn in the catalog's top bar.
Axes, not knobs, and the word is the one the rest of the tool uses:
--axes=theme=dark, describe --axes=true, axes: on an artifact's
address. This was called TopBarState, which named where the control is
drawn rather than what it is, leaving nothing in the API to connect it to
any of those. What makes an axis a different thing from a knob is that it
belongs to the shell rather than to the entry: it persists as you move
between entries, its values are a named set, and a matrix can be taken over
it — the same sense in which a scenario run is crossed over devices and
languages.
Handed to PreviewShell's builder rather than read off a BuildContext, and that confinement is the design rather than an accident of it. An axis outlives the entry on screen because it belongs to the shell, so a stray declaration from somewhere deep inside a demo would go on being offered after the demo that made it was gone, and a subtree built lazily — below a list, behind a tab — would make the top bar grow as you navigated. Knobs can afford to be read from anywhere precisely because they reset with the entry. These cannot.
Every method answers with defaultValue when nothing is driving it, so the
same shell behaves identically in the real app and in Flutter's own
previewer as it does here.
- Implementers
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
flag(
String name, bool defaultValue) → bool -
A switch. A
boolis a closed set of two, which is all an axis needs. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
picker<
T> (String name, Map< String, T> options, T defaultValue, {PickerStyle style = PickerStyle.dropdown}) → T - A choice between named options, label to value.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited