Composer.fromBaseContext constructor

Composer.fromBaseContext(
  1. BuildContext context
)

Implementation

factory Composer.fromBaseContext(BuildContext context) {
  final mediaQuery = MediaQuery.of(context);
  final orientation = mediaQuery.orientation;
  final width = mediaQuery.size.width;
  return Composer(
    context: context,
    isLandscape: orientation == Orientation.landscape,
    isPortrait: orientation == Orientation.portrait,
    isMobile: width < 600, // Mobile if width < 600
    isTablet: width >= 600 && width < 1200, // Tablet if 600 <= width < 1200
    isDesktop: width >= 1200, // Desktop if width >= 1200
  );
}