getConstraints method

BoxConstraints getConstraints(
  1. Size triggerSize,
  2. Size screenSize
)

Returns BoxConstraints calculated from the configuration.

Implementation

BoxConstraints getConstraints(Size triggerSize, Size screenSize) {
  double minWidth = (this.enforceMinWidthToMatchTrigger
      ? triggerSize.width
      : this.minWidth ?? minWidthFraction! * screenSize.width);
  double maxWidth = (this.enforceMaxWidthToMatchTrigger
      ? triggerSize.width
      : this.maxWidth ?? screenSize.width * this.maxWidthFraction!);

  double maxHeight =
      this.maxHeight ?? screenSize.height * this.maxHeightFraction!;
  double minHeight =
      this.minHeight ?? this.minHeightFraction! * screenSize.height;

  return BoxConstraints(
    minWidth: minWidth,
    maxWidth: maxWidth,
    minHeight: minHeight,
    maxHeight: maxHeight,
  ).normalize();
}