defineWidthModalSize method

double defineWidthModalSize(
  1. BuildContext context
)

Calculates the proportional width for a modal dialog based on screen size.

Returns a width factor:

  • 0.50 for screens wider than 2500px or desktops.
  • 0.70 for tablets.
  • 0.95 for mobile devices.

Implementation

double defineWidthModalSize(BuildContext context) {
  double screenWidth = MediaQuery.of(context).size.width;

  if (screenWidth >= 2500) {
    return 0.50;
  } else if (Responsive.isDesktop(context)) {
    return 0.50;
  } else if (Responsive.isTablet(context)) {
    return 0.70;
  } else {
    return 0.95;
  }
}