shadow method

Container shadow(
  1. int strength, {
  2. Color? color,
  3. double? blurRadius,
  4. double? spreadRadius,
  5. Offset? offset,
  6. double? rounded,
})

Add a shadow to the container.

Implementation

Container shadow(
  int strength, {
  Color? color,
  double? blurRadius,
  double? spreadRadius,
  Offset? offset,
  double? rounded,
}) {
  assert(strength >= 1 && strength <= 4, 'strength must be between 1 and 4');

  switch (strength) {
    case 1:
      return _setShadow(
        color ?? Colors.grey.withAlpha((255.0 * 0.4).round()),
        1.5,
        0,
        offset ?? const Offset(0.0, 0.1),
        rounded ?? 0,
      );
    case 2:
      return _setShadow(
        color ?? Colors.grey.withAlpha((255.0 * 0.6).round()),
        2,
        0,
        offset ?? const Offset(0.0, 0.1),
        rounded ?? 0,
      );
    case 3:
      return _setShadow(
        color ?? Colors.black38.withAlpha((255.0 * 0.25).round()),
        5.5,
        0,
        offset ?? const Offset(0.0, 0.1),
        rounded ?? 0,
      );
    case 4:
      return _setShadow(
        color ?? Colors.black38.withAlpha((255.0 * 0.3).round()),
        10,
        1,
        offset ?? const Offset(0.0, 0.1),
        rounded ?? 0,
      );
    default:
      return _setShadow(
        color ?? Colors.grey.withAlpha((255.0 * 0.4).round()),
        1.5,
        0,
        offset ?? const Offset(0.0, 0.1),
        rounded ?? 0,
      );
  }
}