size property Null safety

Size size

Implementation

Size get size {
  double screenWidth = MediaQuery.of(options.context).size.width;
  double screenHeight = MediaQuery.of(options.context).size.height;
  double height = screenHeight > maxHeight ? maxHeight : screenHeight;
  double width;
  height = height - bodyMargin * 2;
  if ((screenHeight - height) < 140) {
    // For keep close button visible
    height = screenHeight - 140;
    width = height / maxHeight * maxWidth;
  } else {
    if (screenWidth > maxWidth) {
      width = maxWidth - bodyMargin * 2;
    } else {
      width = screenWidth - bodyMargin * 2;
    }
    height = width / maxWidth * maxHeight;
  }
  return Size(width, height);
}