constraints method
Implementation
ConstrainedBox constraints(
{double? maxWidth, double? maxHeight, double? minWidth, double? minHeight}) {
BoxConstraints constraints = BoxConstraints(
maxWidth: maxWidth ?? double.infinity,
maxHeight: maxHeight ?? double.infinity,
minWidth: minWidth ?? 0,
minHeight: minHeight ?? 0);
if (this is ConstrainedBox) {
var thisConstraints = (this as ConstrainedBox).constraints;
constraints =
maxWidth?.let((it) => thisConstraints.copyWith(maxWidth: maxWidth)) ?? thisConstraints;
constraints =
maxHeight?.let((it) => thisConstraints.copyWith(maxWidth: maxWidth)) ?? thisConstraints;
constraints =
minWidth?.let((it) => thisConstraints.copyWith(maxWidth: maxWidth)) ?? thisConstraints;
constraints =
minHeight?.let((it) => thisConstraints.copyWith(maxWidth: maxWidth)) ?? thisConstraints;
}
return ConstrainedBox(constraints: constraints, child: this);
}