Breakpoint.fromMediaQuery constructor

Breakpoint.fromMediaQuery(
  1. BuildContext context
)

Following Material Design Guidlines https://material.io/design/layout/responsive-layout-grid.html#grid-behavior

Uses BuildContext and MediaQuery to calculate the device breakpoint

Use Breakpoint.fromConstraints when the widget does not take up the full screen

Implementation

factory Breakpoint.fromMediaQuery(BuildContext context) {
  final _media = MediaQuery.of(context);

  double _width = 359;

  Orientation orientation = Orientation.portrait;

  _width = _media.size.width;
  orientation = _media.orientation;

  return _calcBreakpoint(orientation, _width);
}