CommonLayout constructor

CommonLayout(
  1. double size, {
  2. int desktop = 769,
  3. int tablet = 481,
  4. int phone = 321,
})

Creates a CommonLayout with the specified desktop, tablet and phone breakpoint sizes, each representing a Breakpoint instance of value type CommonBreakpoint.

Implementation

CommonLayout(double size, {int desktop = 769, int tablet = 481, int phone = 321})
    : assert(desktop > tablet),
      assert(tablet > phone),
      super(
        size: size,
        breakpoints: [
          Breakpoint(desktop, value: CommonBreakpoint.desktop),
          Breakpoint(tablet, value: CommonBreakpoint.tablet),
          Breakpoint(phone, value: CommonBreakpoint.phone),
          // Note that the last breakpoint is always created from a `null` value, representing the smallest possible
          // size, which in this case is [CommonBreakpoint.tinyHardware], and this occurs to be the [breakpointValue]
          // when the [size] argument is smaller than the [phone] breakpoint.
          const Breakpoint(null, value: CommonBreakpoint.tinyHardware),
        ],
      );