getRatio static method

double getRatio(
  1. Size size,
  2. BuildContext context
)

This function is used to get Aspect Ratio of the screen

Implementation

static double getRatio(Size size, BuildContext context) {
  EdgeInsets viewPadding = MediaQuery.of(context).viewPadding;
  return (size.height -
          viewPadding.top -
          viewPadding.bottom -
          kToolbarHeight -
          kBottomNavigationBarHeight -
          4) /
      (size.width);
}