getCurrentBreakPoints function

ScreenBreakpoints getCurrentBreakPoints({
  1. required ScreenBreakpoints global,
  2. ScreenBreakpoints? local,
})

Get the ScreenBreakpoints comparing the local, global and default values.

In all cases compare the SBValue type be the same for all comparisons, and the priority of breakpoints are: Local -> Global -> Default(Min or Max)

Implementation

ScreenBreakpoints getCurrentBreakPoints({
  required ScreenBreakpoints global,
  ScreenBreakpoints? local,
}) {
  // the evaluation for SBValues is for MIN or MAX values.
  final bool isMin = local != null ? local.isMinSBValue : global.isMinSBValue;

  final _mobile = _getDefaultOrValue(DeviceScreen.mobile, isMin, global);
  final _tablet = _getDefaultOrValue(DeviceScreen.tablet, isMin, global);
  final _desktop = _getDefaultOrValue(DeviceScreen.desktop, isMin, global);

  final defaultBreakPoints =
      isMin ? defaultMinimumBreakPoints : defaultMaximumBreakPoints;

  return defaultBreakPoints.copyWith(
    mobile: _getDoubleValue(local?.mobile, _mobile),
    tablet: _getDoubleValue(local?.tablet, _tablet),
    desktop: _getDoubleValue(local?.desktop, _desktop),
  );
}