Widgets
FlexBox combines Flutter's Container and Flex widgets with Mix styling.
It provides both box styling (decoration, padding, margins, transforms, constraints)
and flex layout capabilities (direction, alignment, spacing) in a single widget.
This makes it ideal for creating styled flex layouts without nesting multiple widgets.
For specific layouts, use RowBox for horizontal layouts or ColumnBox for vertical layouts.
You can use FlexBoxStyler to create styles with a fluent API. Example:
final flexStyle = FlexBoxStyler ()
. mainAxisSize (.min)
. spacing ( 4 )
. color ( Colors .cyan.shade50)
. padding (. symmetric (horizontal : 10 , vertical : 4 ))
. borderRadius (. circular ( 99 ))
. border (. color ( Colors .cyan.shade600). width ( 2 ));
final iconStyle = IconStyler ()
. icon ( Icons .ac_unit_rounded)
. color ( Colors .cyan.shade600)
. size ( 18 );
final textStyle = TextStyler ()
. fontSize ( 16 )
. fontWeight (.w500)
. color ( Colors .cyan.shade700);
RowBox (
style : flexStyle,
children : [
StyledIcon (style : iconStyle),
StyledText ( 'Snow' , style : textStyle),
],
)
Resolving preview metadata...
Prop Type Required / Default Value styleFlexBoxStyler?Optional, defaults to const FlexBoxStyler.create() styleSpecStyleSpec<FlexBoxSpec>?Optional childrenList<Widget>Optional, defaults to const <Widget>[]
Method Description animateSets the animation property. alignmentSets the alignment property. transformAlignmentSets the transform alignment. clipBehaviorSets the clip behavior. gapSets gap value (deprecated). modifierSets the widget modifier. foregroundDecorationSets the foreground decoration. flexSets the flex property. paddingSets the padding property. marginSets the margin property. transformSets the transform property. decorationSets the decoration property. constraintsSets the constraints property. wrapSets the widget modifier (wrap). variantsSets the variants list. borderRadiusSets the border radius property via decoration. borderSets the border property via decoration.
Method Description borderRadiusAllSets border radius for all corners. borderRadiusTopSets border radius for the top corners. borderRadiusBottomSets border radius for the bottom corners. borderRadiusLeftSets border radius for the left corners. borderRadiusRightSets border radius for the right corners. borderRadiusTopLeftSets border radius for the top left corner. borderRadiusTopRightSets border radius for the top right corner. borderRadiusBottomLeftSets border radius for the bottom left corner. borderRadiusBottomRightSets border radius for the bottom right corner. borderRadiusTopStartSets border radius for the top start corner (directional). borderRadiusTopEndSets border radius for the top end corner (directional). borderRadiusBottomStartSets border radius for the bottom start corner (directional). borderRadiusBottomEndSets border radius for the bottom end corner (directional). borderRoundedSets a uniform circular radius for all corners. borderRoundedTopSets a circular radius for the top corners. borderRoundedBottomSets a circular radius for the bottom corners. borderRoundedLeftSets a circular radius for the left corners. borderRoundedRightSets a circular radius for the right corners. borderRoundedTopLeftSets a circular radius for the top left corner. borderRoundedTopRightSets a circular radius for the top right corner. borderRoundedBottomLeftSets a circular radius for the bottom left corner. borderRoundedBottomRightSets a circular radius for the bottom right corner. borderRoundedTopStartSets a circular radius for the top start corner (directional). borderRoundedTopEndSets a circular radius for the top end corner (directional). borderRoundedBottomStartSets a circular radius for the bottom start corner (directional). borderRoundedBottomEndSets a circular radius for the bottom end corner (directional).
Method Description borderTopSets the top border. borderBottomSets the bottom border. borderLeftSets the left border. borderRightSets the right border. borderStartSets the start border (RTL-aware). borderEndSets the end border (RTL-aware). borderVerticalSets vertical borders (top & bottom). borderHorizontalSets horizontal borders (left & right). borderAllSets all borders.
Method Description widthSets both min and max width to create a fixed width heightSets both min and max height to create a fixed height minWidthSets minimum width constraint maxWidthSets maximum width constraint minHeightSets minimum height constraint maxHeightSets maximum height constraint sizeSets both width and height to specific values constraintsOnlyCreates constraints with only specified values, supporting priority resolution
Method Description colorSets background color gradientSets gradient with any GradientMix type shadowSets single shadow shadowsSets multiple shadows elevationSets elevation shadow imageSets image decoration shapeSets box shape shapeCircleSets a circular shape (CircleBorder) shapeStadiumSets a stadium shape (StadiumBorder) shapeRoundedRectangleSets a rounded rectangle shape (RoundedRectangleBorder) shapeBeveledRectangleSets a beveled rectangle shape (BeveledRectangleBorder) shapeContinuousRectangleSets a continuous rectangle shape (ContinuousRectangleBorder) shapeStarSets a star shape (StarBorder) shapeLinearSets a linear border shape (LinearBorder) shapeSuperellipseSets a superellipse shape (RoundedSuperellipseBorder) backgroundImageSets a background image from an ImageProvider backgroundImageUrlSets a background image from a network URL backgroundImageAssetSets a background image from an asset path foregroundLinearGradientSets a foreground linear gradient foregroundRadialGradientSets a foreground radial gradient foregroundSweepGradientSets a foreground sweep gradient linearGradientSets a background linear gradient radialGradientSets a background radial gradient sweepGradientSets a background sweep gradient
Method Description directionSets flex direction mainAxisAlignmentSets main axis alignment crossAxisAlignmentSets cross axis alignment mainAxisSizeSets main axis size verticalDirectionSets vertical direction textDirectionSets text direction textBaselineSets text baseline spacingSets spacing rowConvenience method for setting direction to horizontal (row) columnConvenience method for setting direction to vertical (column)
Method Description shadowOnlyCreates a single box shadow with named parameters boxShadowsCreates multiple box shadows from a list of BoxShadowMix boxElevationCreates box shadows from Material Design elevation level
Method Description paddingTopSets the top padding. paddingBottomSets the bottom padding. paddingLeftSets the left padding. paddingRightSets the right padding. paddingXSets horizontal (left and right) padding. paddingYSets vertical (top and bottom) padding. paddingAllSets padding on all sides. paddingStartSets the start (leading) padding. paddingEndSets the end (trailing) padding. paddingOnlySets custom padding for each side with priority resolution. marginTopSets the top margin. marginBottomSets the bottom margin. marginLeftSets the left margin. marginRightSets the right margin. marginXSets horizontal (left and right) margin. marginYSets vertical (top and bottom) margin. marginAllSets margin on all sides. marginStartSets the start (leading) margin. marginEndSets the end (trailing) margin. marginOnlySets custom margin for each side with priority resolution.
Method Description rotateSets rotation transform scaleSets scale transform translateSets translation transform skewSets skew transform transformResetResets transform to identity (no effect)
Method Description 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.
Method Description onHoveredCreates a variant for hover state onPressedCreates a variant for pressed state onFocusedCreates a variant for focused state. Requires Pressable or PressableBox wrapper for focus tracking. onDisabledCreates a variant for disabled state onEnabledCreates a variant for enabled state (opposite of disabled)
View page source on GitHub Style Flutter containers with BoxStyler — decoration, padding, margins, transforms, constraints, and interaction variants in Mix.
Style Flutter text with TextStyler — font size, weight, color, decorations, text directives, and responsive variants in Mix.