StateVariantsWrapper class
Wrapper that displays component state variants in different modes
Provides two display modes:
- Static: Shows all state variants side-by-side with labels
- Auto-Cycle: Shows one component cycling through states automatically
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- StateVariantsWrapper
Constructors
- StateVariantsWrapper({Key? key, required String componentName, required Widget buildRestState(), required Widget buildPressedState(), required Widget buildHoverState(), Widget buildDisabledState()?, Widget buildCyclingState(int stateIndex)?, Duration cycleDuration = const Duration(milliseconds: 1500), PreviewMode initialMode = PreviewMode.static, VoidCallback? onResetToDefaults, VoidCallback? onCopySnippet, Color? themedBackgroundColor})
-
const
Properties
- buildCyclingState → Widget Function(int stateIndex)?
-
Builder for auto-cycling variant (receives current state index)
0 = Rest, 1 = Hover, 2 = Pressed, 3 = Rest again
final
- buildDisabledState → Widget Function()?
-
Builder for the disabled state appearance (optional)
final
- buildHoverState → Widget Function()
-
Builder for the hover state appearance
final
- buildPressedState → Widget Function()
-
Builder for the pressed state appearance
final
- buildRestState → Widget Function()
-
Builder for the rest/default state (interactive)
final
- componentName → String
-
Name of the component being previewed
final
- cycleDuration → Duration
-
Duration each state is shown in auto-cycle mode (default: 1.5 seconds)
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialMode → PreviewMode
-
Initial preview mode
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onCopySnippet → VoidCallback?
-
Callback to copy component usage code snippet (Phase 4)
When provided, a "Copy Code" button appears in the toolbar
final
- onResetToDefaults → VoidCallback?
-
Callback to reset component state to defaults (Phase 3)
When provided, a "Reset" button appears in the toolbar
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- themedBackgroundColor → Color?
-
Themed background color from palette (passed from parent)
This is used for the inner container around buttons
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< StateVariantsWrapper> -
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