Responsive.fromContext constructor

Responsive.fromContext(
  1. BuildContext context
)

Creates a Responsive instance from the given context.

Implementation

factory Responsive.fromContext(BuildContext context) {
  final Size size = MediaQuery.sizeOf(context);
  final double w = size.width;
  return Responsive(
    size: size,
    isMobile: w <= mobileWidth,
    isSmallerTablet: w >= mobileWidth && w < tabletWidth,
    isTablet: w >= mobileWidth && w < desktopWidth,
    isDesktop: w >= desktopWidth,
  );
}