constrainedHeight function

double constrainedHeight(
  1. BuildContext context,
  2. double preferredHeight
)

Method to get preferredHeight constrained, if is bigger than media query height, will return this.

Implementation

double constrainedHeight (BuildContext context, double preferredHeight) {
  double height = preferredHeight;
  if (preferredHeight > MediaQuery.of(context).size.height) {
    height = MediaQuery.of(context).size.height;
  }

  return height;
}