responsiveValueOrNull<T> function

T? responsiveValueOrNull<T>(
  1. BuildContext context, {
  2. required T? xs,
  3. required T? sm,
  4. required T? md,
  5. required T? lg,
  6. required T? xl,
  7. required T? xxl,
})

Implementation

T? responsiveValueOrNull<T>(
  BuildContext context, {
  required T? xs,
  required T? sm,
  required T? md,
  required T? lg,
  required T? xl,
  required T? xxl,
}) {
  final screenData = BootstrapTheme.of(context);
  final breakPoint = screenData.currentBreakPoint;
  final breakPoints = screenData.breakPoints;

  T? value;

  if (breakPoint.isBreakPointOrLarger(breakPoints.xs) && xs != null) {
    value = xs;
  }
  if (breakPoint.isBreakPointOrLarger(breakPoints.sm) && sm != null) {
    value = sm;
  }
  if (breakPoint.isBreakPointOrLarger(breakPoints.md) && md != null) {
    value = md;
  }
  if (breakPoint.isBreakPointOrLarger(breakPoints.lg) && lg != null) {
    value = lg;
  }
  if (breakPoint.isBreakPointOrLarger(breakPoints.xl) && xl != null) {
    value = xl;
  }
  if (breakPoint.isBreakPointOrLarger(breakPoints.xxl) && xxl != null) {
    value = xxl;
  }

  return value;
}