constrained method

Widget constrained({
  1. Key? key,
  2. double? width,
  3. double? height,
  4. double minWidth = 0.0,
  5. double maxWidth = double.infinity,
  6. double minHeight = 0.0,
  7. double maxHeight = double.infinity,
  8. bool animate = false,
})

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,
        );
}