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

StyledImage

StyledImage is equivalent to Flutter’s Image widget, but provides styling capabilities through the Mix framework. It allows you to create visually styled images with dimensions, colors, blend modes, filters, and responsive variants.

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

final style = ImageStyler() .width(200) .height(200) .fit(BoxFit.cover) .color(Colors.blue.withOpacity(0.5)) .colorBlendMode(BlendMode.overlay); StyledImage( image: AssetImage('assets/photo.jpg'), style: style, )

Constructor

PropTypeRequired / Default Value
styleStyleconst ImageStyler.create()
styleSpecStyleSpec?Optional
frameBuilderImageFrameBuilder?Optional
loadingBuilderImageLoadingBuilder?Optional
errorBuilderImageErrorWidgetBuilder?Optional
imageImageProvider<Object>?Optional
opacityAnimation<double>?Optional

Style API Reference

StyledImage Methods

MethodDescription
imageSets image provider
widthSets image width
heightSets image height
colorSets image color
repeatSets image repeat
fitSets image fit
alignmentSets image alignment
centerSliceSets center slice
filterQualitySets filter quality
colorBlendModeSets color blend mode
semanticLabelSets semantic label
excludeFromSemanticsSets exclude from semantics
gaplessPlaybackSets gapless playback
isAntiAliasSets is anti alias
matchTextDirectionSets match text direction
modifierSets the widget modifier.
animateConvenience method for animating the ImageStyleSpec
variantsSets the variants list.
wrapSets the widget modifier.

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)