Breakpoint.fromConstraints constructor

Breakpoint.fromConstraints(
  1. BoxConstraints constraints
)

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

Use a layout builder to get BoxConstraints

Implementation

factory Breakpoint.fromConstraints(BoxConstraints constraints) {
  double _width = 359;

  Orientation orientation = Orientation.portrait;

  if (constraints.debugAssertIsValid()) {
    _width = constraints.normalize().maxWidth;
    orientation = constraints.maxHeight > constraints.maxWidth
        ? Orientation.portrait
        : Orientation.landscape;
  }

  return _calcBreakpoint(orientation, _width);
}