scaled static method

List<BoxShadow> scaled(
  1. double elevation
)

Returns the default shadows scaled by elevation.

  • 0.0 → empty list (no shadow)
  • 1.0 → defaults (unchanged)
  • 2.0 → double opacity and blur

Opacity is clamped to 0.0–1.0; blur and offset scale linearly.

Implementation

static List<BoxShadow> scaled(double elevation) {
  if (elevation <= 0) return const [];
  if (elevation == 1.0) return defaults;
  return [
    BoxShadow(
      color: Color.fromRGBO(0, 0, 0, (0.06 * elevation).clamp(0.0, 1.0)),
      blurRadius: 8 * elevation,
      spreadRadius: 0,
      offset: Offset(0, 2 * elevation),
    ),
    BoxShadow(
      color: Color.fromRGBO(0, 0, 0, (0.02 * elevation).clamp(0.0, 1.0)),
      blurRadius: 2 * elevation,
      spreadRadius: 0,
      offset: Offset(0, 1 * elevation),
    ),
  ];
}