constrained method
Implementation
Widget constrained(
{double? minWidth,
double? maxWidth,
double? minHeight,
double? maxHeight}) {
if (this is ConstrainedBox) {
return ConstrainedBox(
constraints: BoxConstraints(
minWidth: minWidth ?? (this as ConstrainedBox).constraints.minWidth,
maxWidth: maxWidth ?? (this as ConstrainedBox).constraints.maxWidth,
minHeight:
minHeight ?? (this as ConstrainedBox).constraints.minHeight,
maxHeight:
maxHeight ?? (this as ConstrainedBox).constraints.maxHeight,
),
child: (this as ConstrainedBox).child,
);
}
return ConstrainedBox(
constraints: BoxConstraints(
minWidth: minWidth ?? 0,
maxWidth: maxWidth ?? double.infinity,
minHeight: minHeight ?? 0,
maxHeight: maxHeight ?? double.infinity,
),
child: this,
);
}