ConstrainedBox constructor

ConstrainedBox({
  1. Object? child,
  2. List<Object?> children = const [],
  3. Object? minWidth,
  4. Object? maxWidth,
  5. Object? minHeight,
  6. Object? maxHeight,
  7. bool center = false,
  8. String? className,
  9. Map<String, Object?> props = const {},
  10. Map<String, Object?> style = const {},
  11. DartStyle? dartStyle,
})

Creates a constrained wrapper around child content.

Implementation

ConstrainedBox({
  Object? child,
  List<Object?> children = const [],
  Object? minWidth,
  Object? maxWidth,
  Object? minHeight,
  Object? maxHeight,
  bool center = false,
  String? className,
  Map<String, Object?> props = const {},
  Map<String, Object?> style = const {},
  DartStyle? dartStyle,
}) : super(
        'div',
        props: mergeComponentProps(
          props,
          className: className,
          dartStyle: DartStyle(
            width: SizeValue.full,
            minWidth: minWidth,
            maxWidth: maxWidth,
            minHeight: minHeight,
            maxHeight: maxHeight,
            margin: center
                ? const EdgeInsets.symmetric(horizontal: SizeValue.auto)
                : null,
          ).merge(dartStyle),
          style: style,
        ),
        children: normalizeChildren(child, children),
      );