constrained method
Implementation
Widget constrained({
Key? key,
double? width,
double? height,
double minWidth = 0.0,
double maxWidth = double.infinity,
double minHeight = 0.0,
double maxHeight = double.infinity,
bool animate = false,
}) {
BoxConstraints constraints = BoxConstraints(
minWidth: minWidth,
maxWidth: maxWidth,
minHeight: minHeight,
maxHeight: maxHeight,
);
constraints = (width != null || height != null)
? constraints.tighten(width: width, height: height)
: constraints;
return animate
? _StyledAnimatedBuilder(
key: key,
builder: (animation) {
return _AnimatedConstrainedBox(
child: this,
constraints: constraints,
duration: animation.duration,
curve: animation.curve,
);
},
)
: ConstrainedBox(
key: key,
child: this,
constraints: constraints,
);
}