playgrounder 0.3.1
playgrounder: ^0.3.1 copied to clipboard
An opinionated playground builder for Flutter components: live preview, presets, and knobs.
Changelog #
0.3.1 #
Documentation only; no API change.
Narrows the advice about hoisting builders. It read as a general rule, which
is wrong: Flutter's own source passes inline closures to builder parameters
roughly seven times as often as hoisted functions, and a builder handed
straight to a widget is never compared. The advice is specific to builders held
on PlaygroundThemeData, which PlaygroundTheme compares to decide whether to
rebuild.
0.3.0 - 2026-09-01 #
DEPRECATED: PlaygroundStyle and PlaygroundStyleScope still work and are
adapted onto the new seam, so existing code runs unchanged. Both are removed in
0.4.0.
Migrate by setting one builder per slot you actually overrode:
// before
class MyStyle extends PlaygroundStyle {
@override
Widget buildActionButton(BuildContext context, {...}) => MyButton(...);
}
PlaygroundStyleScope(style: const MyStyle(), child: child)
// after
Widget myActionButton(BuildContext c, PlaygroundActionDetails d) =>
MyButton(label: d.label, icon: d.icon, onPressed: d.onPressed);
PlaygroundTheme(
data: const PlaygroundThemeData(actionButtonBuilder: myActionButton),
child: child,
)
The slots are tabsBuilder, presetRowBuilder and actionButtonBuilder; null
means the Material default, so overriding one leaves the others alone and no
subclassing is needed. Hoist these builders to top-level or static functions:
a builder stored on a theme is compared by identity, so an inline closure makes
the theme unequal on every build. (A builder passed straight to a widget is
never compared, which is why inline closures are normal there.)
stageBackground was a method resolving a colour from a context; it is now a
nullable Color field on PlaygroundThemeData, since the right stage tint is
a fact about the design system's ColorScheme rather than a per-build
computation. Null still resolves to surfaceContainerHighest.
Playground.inspectorWidth and Playground.splitBreakpoint are now nullable
and fall back to the theme, so a design system states them once instead of at
every playground. Passing them per playground still works and still wins.
Refactors #
- carry the chrome seam inside a theme (be8e0f2)
0.2.0 #
BREAKING: Playground.actions is replaced by a single footer slot that
accepts any widget. Actions are now prefab footer content: migrate
Playground(actions: [...]) to
Playground(footer: PlaygroundActions(actions: [...])). PlaygroundActions
is exported for this; it still styles each button through the ambient
PlaygroundStyle, and the footer region supplies the divider and inset once,
so composing actions with other pinned content does not double the chrome.
0.1.0 #
Initial release: Playground, PlaygroundPreset, PlaygroundAction,
PlaygroundStyle and PlaygroundStyleScope, and the StepKnob, SwitchKnob,
ScaleKnob (with ScaleStep), DropdownKnob, KnobGroup, and KnobRelevance
inspector controls. Playground exposes inspectorWidth and splitBreakpoint
for tuning the docked layout.