getShadows static method

List<BoxShadow> getShadows([
  1. ContentDesignStyle style = ContentDesignStyle.solid,
  2. Color? accentColor,
  3. bool isDark = false
])

Returns layered shadows for the given style.

When accentColor is provided the elevation includes a tinted glow in that color (the signature bold look); otherwise a neutral ambient elevation is used. isDark deepens the ambient layer.

Implementation

static List<BoxShadow> getShadows([
  ContentDesignStyle style = ContentDesignStyle.solid,
  Color? accentColor,
  bool isDark = false,
]) {
  if (style == ContentDesignStyle.minimal) return SpShadows.flat;
  if (style == ContentDesignStyle.neon) {
    return accentColor != null
        ? SpShadows.neon(color: accentColor)
        : SpShadows.ambient(isDark: isDark);
  }

  // Bolder styles float higher.
  final level = switch (style) {
    ContentDesignStyle.colorHeader || ContentDesignStyle.solid => 1.0,
    ContentDesignStyle.tonal || ContentDesignStyle.glass => 0.85,
    ContentDesignStyle.outlined || ContentDesignStyle.leftAccent => 0.7,
    ContentDesignStyle.minimal || ContentDesignStyle.neon => 1.0,
  };

  if (accentColor != null) {
    return SpShadows.glow(color: accentColor, isDark: isDark, level: level);
  }
  return SpShadows.ambient(isDark: isDark, level: level);
}