Style<S extends Spec<S>> class abstract

Base class for style classes that can be resolved to specifications.

Provides variant support, modifiers, and animation configuration for styled elements.

Inheritance
Implementers

Constructors

Style({required List<VariantStyle<S>>? variants, required WidgetModifierConfig? modifier, required AnimationConfig? animation})
const

Properties

$animation → AnimationConfig?
final
$modifier → WidgetModifierConfig?
final
$variants → List<VariantStyle<S>>?
final
hashCode → int
Overrides the hash code getter to compute hash code based on properties.
no setterinherited
mergeKey → Object
Default implementation uses runtimeType as the merge key
no setteroverride
props → List<Object?>
The properties based on which equality and hash code are computed.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stringify → bool
Whether to use a detailed string representation of the object.
no setterinherited

Methods

build(BuildContext context, {Set<NamedVariant> namedVariants = const {}}) → StyleSpec<S>
Builds the style into a fully resolved spec with metadata.
getDiff(Equatable other) → Map<String, String>
Returns a map of properties that differ between this object and another.
inherited
merge(covariant Style<S>? other) → Style<S>
Merges this attribute with another attribute of the same type.
override
mergeActiveVariants(BuildContext context, {required Set<NamedVariant> namedVariants}) → Style<S>
Merges all active variants with their nested variants recursively.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(BuildContext context) → StyleSpec<S>
Resolves this attribute to its concrete value using the provided BuildContext.
override
toString() → String
Overrides string representation for debugging and logging.
inherited

Operators

operator ==(Object other) → bool
Overrides the equality operator to compare based on the properties.
inherited

Static Methods

maybeOf<S extends Spec<S>>(BuildContext context) → Style<S>?
Gets the closest Style from the widget tree, or null if not found.
of<S extends Spec<S>>(BuildContext context) → Style<S>
Gets the closest Style from the widget tree.