widget property

Widget get widget

The Widget selected, depending on the size of the parent widget.

Implementation

Widget get widget {
  return LayoutBuilder(
    builder: (context, constraints) {
      var settings = breakpoints ?? FluidoSettings.breakpoints;
      var width = constraints.maxWidth;

      if (width < settings.sm) {
        return sm;
      } else if (width < settings.md) {
        return md ?? sm;
      } else if (width < settings.lg) {
        return lg ?? md ?? sm;
      } else if (width < settings.xl) {
        return xl ?? lg ?? md ?? sm;
      } else {
        return xl2 ?? xl ?? lg ?? md ?? sm;
      }
    },
  );
}