constrained method

Widget constrained({
  1. SizeUnit? minWidth,
  2. SizeUnit? maxWidth,
  3. SizeUnit? minHeight,
  4. SizeUnit? maxHeight,
  5. Key? key,
})

Sets comprehensive size constraints including both minimum and maximum bounds.

This is a convenience method that combines all size constraint options in a single call. Any combination of minimum and maximum width/height can be specified to create a constrained size box.

Example:

Container().constrained(
  minWidth: 100.size,
  maxWidth: 300.size,
  minHeight: 50.size,
  maxHeight: 200.size,
),

Implementation

Widget constrained({
  SizeUnit? minWidth,
  SizeUnit? maxWidth,
  SizeUnit? minHeight,
  SizeUnit? maxHeight,
  Key? key,
}) {
  return _WidgetWrapper._wrapOrCopyWith(
    child: this,
    key: key != null ? () => key : null,
    minWidth: minWidth != null ? () => minWidth : null,
    maxWidth: maxWidth != null ? () => maxWidth : null,
    minHeight: minHeight != null ? () => minHeight : null,
    maxHeight: maxHeight != null ? () => maxHeight : null,
  );
}