Skip to Content
Mix 2.0 is in development! You can access the Mix 1.0 docs here.

StyledIcon

StyledIcon is equivalent to Flutter’s Icon widget, but provides styling capabilities through the Mix framework. It allows you to create visually styled icons with color, size, shadows, and responsive variants.

You can use IconStyler to create styles with a fluent API. Example:

final style = IconStyler() .size(32) .color(Colors.blue); StyledIcon( Icons.favorite, style: style, )

Constructor

PropTypeRequired / Default Value
iconIconData?Optional
semanticLabelString?Optional
styleStyleconst IconStyler.create()
styleSpecStyleSpec?Optional

Style API Reference

StyledIcon Methods

MethodDescription
colorSets icon color
sizeSets icon size
weightSets icon weight
gradeSets icon grade
opticalSizeSets icon optical size
shadowSets single icon shadow
shadowsSets icon shadows
textDirectionSets text direction
applyTextScalingSets apply text scaling
fillSets icon fill
semanticsLabelSets semantics label
opacitySets opacity
blendModeSets blend mode
iconSets icon data
modifierSets the widget modifier.
animateSets animation
variantsSets the variants list.
wrapSets the widget modifier.

Animation

MethodDescription
keyframeAnimationCreates a keyframe animation. It will animate through the given timeline.
phaseAnimationCreates a phase animation. It will animate through the given phases.

Variant

MethodDescription
variantAdds a single variant to this style.
onDarkCreates a variant for dark mode.
onNotCreates a variant for when the context does NOT match the provided variant.
onLightCreates a variant for light mode.
onBuilderCreates a variant using a builder function that receives the build context.
builderDeprecated: Use [onBuilder] instead.
onBreakpointCreates a variant based on the specified breakpoint.
onPortraitCreates a variant for portrait device orientation.
onLandscapeCreates a variant for landscape device orientation.
onMobileCreates a variant for mobile breakpoint.
onTabletCreates a variant for tablet breakpoint.
onDesktopCreates a variant for desktop breakpoint.
onLtrCreates a variant for left-to-right text direction.
onRtlCreates a variant for right-to-left text direction.
onIosCreates a variant for iOS platform.
onAndroidCreates a variant for Android platform.
onMacosCreates a variant for macOS platform.
onWindowsCreates a variant for Windows platform.
onLinuxCreates a variant for Linux platform.
onFuchsiaCreates a variant for Fuchsia platform.
onWebCreates a variant for web platform.

Widget State Variant

MethodDescription
onHoveredCreates a variant for hover state
onPressedCreates a variant for pressed state
onFocusedCreates a variant for focused state
onDisabledCreates a variant for disabled state
onEnabledCreates a variant for enabled state (opposite of disabled)