Container constructor
Container({
- BloomNode? child,
- EdgeInsets? padding,
- EdgeInsets? margin,
- Color? color,
- num? width,
- num? height,
- Alignment? alignment,
- BoxDecoration? decoration,
- num? minWidth,
- num? maxWidth,
- num? minHeight,
- num? maxHeight,
Creates a box with dimensions, spacing, alignment, and decoration.
Container(color: Colors.blue, child: StyledText('Hi'));
Implementation
Container(
{BloomNode? child,
EdgeInsets? padding,
EdgeInsets? margin,
Color? color,
num? width,
num? height,
Alignment? alignment,
BoxDecoration? decoration,
num? minWidth,
num? maxWidth,
num? minHeight,
num? maxHeight})
: super('div',
children: child == null ? const [] : [child],
style: _css([
if (padding != null) 'padding: ${padding.css}',
if (margin != null) 'margin: ${margin.css}',
if (color != null) 'background-color: ${color.css}',
if (width != null) 'width: ${_px(width)}',
if (height != null) 'height: ${_px(height)}',
if (alignment != null)
'display: grid; place-items: ${_place(alignment)}',
if (minWidth != null) 'min-width: ${_px(minWidth)}',
if (maxWidth != null) 'max-width: ${_px(maxWidth)}',
if (minHeight != null) 'min-height: ${_px(minHeight)}',
if (maxHeight != null) 'max-height: ${_px(maxHeight)}',
decoration?.css ?? '',
]));