previews library
What a project writes beside its @Previews: a shell, and knobs.
The annotation itself is not here — it is Flutter's, from
package:flutter/widget_previews.dart, and a preview that wants nothing
from this library does not import it. That is why the library is kept
being small: the dependency is incremental, paid when you want a shell or a
knob rather than to declare a preview at all.
Deliberately small for the other reason too — this is published surface, and
every name here is a semver commitment. The machinery the flutterware GUI
drives inside the guest lives in previews_guest.dart, imported only by
generated code.
See also ui_catalog.dart, which is the other thing: a browsable page you
ship inside your own app, hosting these same previews.
Classes
- Knobs
- The controls an entry declares by asking for them while it builds.
- PreviewAxes
- The app-wide switches a project's shell offers — a theme, a locale, a flavour — drawn in the catalog's top bar.
- PreviewShell
- A project's catalog shell: the chrome every demo is rendered inside, and the one place its top-bar switches are declared.
Enums
- PickerStyle
- How a picker asks to be drawn — a knob's, or a shell's axis in the top bar.
Extensions
- KnobsExtension on BuildContext
-
The controls this entry asks for while it builds —
context.knobs.bool(…).