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

Box

This is equivalent to the Container widget in Flutter.

Box( style: BoxStyler() .width(100) .height(100) .color(Colors.blue) .borderRounded(8), child: Text('Styled Box'), );

Constructor

PropTypeRequired / Default Value
childWidget?Optional
styleStyle<BoxSpec>Optional, defaults to BoxStyler.create()
keyKey?Optional

Style API Reference

MethodDescription
animateSets animation configuration
modifierAdds widget modifiers
alignmentSets box alignment
transformAlignmentSets transform alignment
clipBehaviorSets clip behavior
paddingSets padding
marginSets margin
transformSets transform matrix
decorationSets decoration
foregroundDecorationSets foreground decoration
constraintsSets box constraints
widthSets fixed width
heightSets fixed height
minWidthSets minimum width
maxWidthSets maximum width
minHeightSets minimum height
maxHeightSets maximum height
sizeSets both width and height
constraintsOnlySets specific constraints
paddingTopSets top padding
paddingBottomSets bottom padding
paddingLeftSets left padding
paddingRightSets right padding
paddingXSets horizontal padding
paddingYSets vertical padding
paddingAllSets padding on all sides
paddingStartSets start padding (RTL-aware)
paddingEndSets end padding (RTL-aware)
paddingOnlySets specific padding values
marginTopSets top margin
marginBottomSets bottom margin
marginLeftSets left margin
marginRightSets right margin
marginXSets horizontal margin
marginYSets vertical margin
marginAllSets margin on all sides
marginStartSets start margin (RTL-aware)
marginEndSets end margin (RTL-aware)
marginOnlySets specific margin values
colorSets background color
gradientSets gradient background
shadowSets single shadow
shadowsSets multiple shadows
elevationSets Material elevation
imageSets background image
shapeSets shape
borderSets border
borderRadiusSets border radius
borderTopSets top border
borderBottomSets bottom border
borderLeftSets left border
borderRightSets right border
borderStartSets start border (RTL-aware)
borderEndSets end border (RTL-aware)
borderVerticalSets top and bottom borders
borderHorizontalSets left and right borders
borderAllSets all borders
borderRadiusAllSets radius on all corners
borderRadiusTopSets radius on top corners
borderRadiusBottomSets radius on bottom corners
borderRadiusLeftSets radius on left corners
borderRadiusRightSets radius on right corners
borderRadiusTopLeftSets top-left radius
borderRadiusTopRightSets top-right radius
borderRadiusBottomLeftSets bottom-left radius
borderRadiusBottomRightSets bottom-right radius
borderRadiusTopStartSets top-start radius (RTL-aware)
borderRadiusTopEndSets top-end radius (RTL-aware)
borderRadiusBottomStartSets bottom-start radius (RTL-aware)
borderRadiusBottomEndSets bottom-end radius (RTL-aware)
borderRoundedSets circular radius on all corners
borderRoundedTopSets circular radius on top corners
borderRoundedBottomSets circular radius on bottom corners
borderRoundedLeftSets circular radius on left corners
borderRoundedRightSets circular radius on right corners
borderRoundedTopLeftSets circular top-left radius
borderRoundedTopRightSets circular top-right radius
borderRoundedBottomLeftSets circular bottom-left radius
borderRoundedBottomRightSets circular bottom-right radius
borderRoundedTopStartSets circular top-start radius (RTL-aware)
borderRoundedTopEndSets circular top-end radius (RTL-aware)
borderRoundedBottomStartSets circular bottom-start radius (RTL-aware)
borderRoundedBottomEndSets circular bottom-end radius (RTL-aware)
shadowOnlyCreates single shadow with parameters
boxShadowsSets multiple box shadows
boxElevationSets Material elevation shadow
rotateSets rotation transform
scaleSets scale transform
translateSets translation transform
skewSets skew transform
transformResetResets transform to identity