MagicPreviewCatalog class

The dev-only component preview catalog.

Renders a scrollable sidebar of PreviewEntry labels next to a SINGLE active preview pane: tapping a sidebar item (or deep-linking /preview/<slug>) swaps the pane to that entry. Only the selected preview is built, so a large catalog (including heavy controller-backed screen previews) stays responsive instead of mounting every section at once. The header shows the active entry's label plus a "Toggle theme" button bound to wind's WindThemeController for a global light/dark flip.

Release boundary

This widget is only ever instantiated from within MagicPreview.registerRoutes, which is guarded by kReleaseMode + bool.fromEnvironment('PREVIEW_ENABLED'). It must never be referenced from a top-level const/final collection (the dart-lang/sdk#33920 foot-gun that retains widget refs in release); keep every reference inside a function body.

Inheritance

Constructors

MagicPreviewCatalog({Key? key, required List<PreviewEntry> entries, String? activeSlug, ValueChanged<PreviewEntry>? onSelect})
Creates the catalog over entries.
const

Properties

activeSlug → String?
The slug of the entry to display; null shows the first entry.
final
entries → List<PreviewEntry>
The previews to host. Passed in (never read from a top-level const) so the release boundary can stay airtight.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onSelect → ValueChanged<PreviewEntry>?
Invoked when a sidebar item is tapped. The /preview route wires this to navigation; when null, selection updates local state only.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

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