renderSizedBox function

Component renderSizedBox(
  1. SizedBoxProps props
)

Renders a sized box component.

Implementation

Component renderSizedBox(SizedBoxProps props) {
  final bool isExpand = props.width == double.infinity || props.height == double.infinity;

  return dom.div(
    classes: 'arcane-sized-box',
    styles: dom.Styles(raw: {
      if (props.width != null && !isExpand) 'width': '${props.width}px',
      if (props.height != null && !isExpand) 'height': '${props.height}px',
      if (props.width == double.infinity) 'width': '100%',
      if (props.height == double.infinity) 'height': '100%',
      'flex-shrink': '0',
    }),
    props.child != null ? [props.child!] : [],
  );
}