VariantStyleMixin<T extends Style<S>, S extends Spec<S>> mixin

Mixin that provides convenient variant styling methods for spec attributes.

This mixin follows the same pattern as ModifierMixin, providing a fluent API for applying context variants to spec attributes.

Superclass constraints
Mixin applications

Properties

$animation AnimationConfig?
finalinherited
$modifier WidgetModifierConfig?
finalinherited
$variants List<VariantStyle<S>>?
finalinherited
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 setterinherited
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

applyVariants(Iterable<NamedVariant> variantsToApply) → T
Applies the specified named variants by merging their styles into this style.
build(BuildContext context, {Set<NamedVariant> namedVariants = const {}}) StyleSpec<S>
Builds the style into a fully resolved spec with metadata.
inherited
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.
inherited
mergeActiveVariants(BuildContext context, {required Set<NamedVariant> namedVariants}) Style<S>
Merges all active variants with their nested variants recursively.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onAndroid(T style) → T
Creates a variant for Android platform.
onBreakpoint(Breakpoint breakpoint, T style) → T
Creates a variant based on the specified breakpoint.
onBuilder(T fn(BuildContext context)) → T
Creates a variant using a builder function that receives the build context.
onDark(T style) → T
Creates a variant for dark mode.
onDesktop(T style) → T
Creates a variant for desktop breakpoint.
onFuchsia(T style) → T
Creates a variant for Fuchsia platform.
onIos(T style) → T
Creates a variant for iOS platform.
onLandscape(T style) → T
Creates a variant for landscape device orientation.
onLight(T style) → T
Creates a variant for light mode.
onLinux(T style) → T
Creates a variant for Linux platform.
onLtr(T style) → T
Creates a variant for left-to-right text direction.
onMacos(T style) → T
Creates a variant for macOS platform.
onMobile(T style) → T
Creates a variant for mobile breakpoint.
onNot(ContextVariant contextVariant, T style) → T
Creates a variant for when the context does NOT match the provided variant.
onPortrait(T style) → T
Creates a variant for portrait device orientation.
onRtl(T style) → T
Creates a variant for right-to-left text direction.
onTablet(T style) → T
Creates a variant for tablet breakpoint.
onWeb(T style) → T
Creates a variant for web platform.
onWindows(T style) → T
Creates a variant for Windows platform.
resolve(BuildContext context) StyleSpec<S>
Resolves this attribute to its concrete value using the provided BuildContext.
inherited
toString() String
Overrides string representation for debugging and logging.
inherited
variant(Variant variant, T style) → T
Adds a single variant to this style.
variants(List<VariantStyle<S>> value) → T
Sets the list of variant styles. Must be implemented by the class using this mixin.

Operators

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