getResponsivePadding static method

EdgeInsets getResponsivePadding(
  1. BuildContext context, {
  2. EdgeInsets? xs,
  3. EdgeInsets? sm,
  4. EdgeInsets? md,
  5. EdgeInsets? lg,
  6. EdgeInsets? xl,
  7. EdgeInsets? base,
})

Get responsive padding based on screen size

Implementation

static EdgeInsets getResponsivePadding(
  BuildContext context, {
  EdgeInsets? xs,
  EdgeInsets? sm,
  EdgeInsets? md,
  EdgeInsets? lg,
  EdgeInsets? xl,
  EdgeInsets? base,
}) {
  final screenSize = getScreenSize(context);

  switch (screenSize) {
    case ScreenSize.xs:
      return xs ?? base ?? const EdgeInsets.all(8.0);
    case ScreenSize.sm:
      return sm ?? xs ?? base ?? const EdgeInsets.all(12.0);
    case ScreenSize.md:
      return md ?? sm ?? xs ?? base ?? const EdgeInsets.all(16.0);
    case ScreenSize.lg:
      return lg ?? md ?? sm ?? xs ?? base ?? const EdgeInsets.all(20.0);
    case ScreenSize.xl:
      return xl ?? lg ?? md ?? sm ?? xs ?? base ?? const EdgeInsets.all(24.0);
  }
}