getContextualScreenSize function

ScreenSize getContextualScreenSize({
  1. required BuildContext context,
  2. Orientation? orientation,
  3. LayoutSize defaultSize = LayoutSize.mobile,
  4. ScreenSizeSettings sizes = const ScreenSizeSettings.portrait(),
})

Gets type of screen size based on BuildContext

sizes defaults to ScreenSizeSettings.portrait() defaultSize defaults to LayoutSize.mobile

orientation is mostly needed for ResponsiveLayoutBuilder

context must not be null

Implementation

ScreenSize getContextualScreenSize({
  required BuildContext context,
  Orientation? orientation,
  LayoutSize defaultSize = LayoutSize.mobile,
  ScreenSizeSettings sizes = const ScreenSizeSettings.portrait(),
}) {
  return getScreenSize(
    width: MediaQuery.of(context).size.width,
    defaultSize: defaultSize,
    orientation: orientation,
    sizes: sizes,
  );
}