StyleSpec<T extends Spec<T> > class
A widget specification that wraps a pure Spec with widget metadata.
This class provides a way to add widget-level metadata (animation, modifiers) to any Spec without requiring the Spec to extend StyleSpec directly. This promotes clean separation between data specs and widget metadata.
Example:
// Pure data spec
final boxSpec = BoxSpec(padding: EdgeInsets.all(16));
// Wrapped with metadata
final wrappedSpec = StyleSpec(
spec: boxSpec,
animation: AnimationConfig.curve(),
);
- Inheritance
- Mixed-in types
- Available extensions
Constructors
-
StyleSpec({required T spec, AnimationConfig? animation, List<
WidgetModifier< ? widgetModifiers})WidgetModifier> > -
Creates a StyleSpec with the provided spec and optional metadata.
const
Properties
- animation → AnimationConfig?
-
Optional animation configuration attached to this spec.
final
- hashCode → int
-
Overrides the hash code getter to compute hash code based on properties.
no setterinherited
-
props
→ List<
Object?> -
The list of properties that constitute the state of this StyleSpec.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- spec → T
-
The underlying specification that holds the actual data.
final
- stringify → bool
-
Whether to use a detailed string representation of the object.
no setterinherited
- type → Type
-
no setterinherited
-
widgetModifiers
→ List<
WidgetModifier< ?WidgetModifier> > -
Widget-level modifiers to apply around the built widget.
final
Methods
-
copyWith(
{T? spec, AnimationConfig? animation, List< WidgetModifier< ? widgetModifiers}) → StyleSpec<WidgetModifier> >T> -
Creates a copy of this StyleSpec with the given fields
replaced by the new values.
override
-
createBuilder(
Widget builder(BuildContext context, T spec)) → Widget -
Available on StyleSpec<
Creates a widget using a custom builder function that receives the resolved spec.T> , provided by the StyleSpecWidgetBuilder extension -
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
override
-
getDiff(
Equatable other) → Map< String, String> -
Returns a map of properties that differ between this object and another.
inherited
-
lerp(
covariant StyleSpec< T> ? other, double t) → StyleSpec<T> -
Linearly interpolates between this StyleSpec and another.
override
-
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
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
inherited
Operators
-
operator ==(
Object other) → bool -
Overrides the equality operator to compare based on the properties.
inherited