glow static method
Elevation with an accent glow. level 0..1 scales intensity.
Implementation
static List<BoxShadow> glow({
required Color color,
required bool isDark,
double level = 1.0,
Offset direction = const Offset(0, 1),
}) {
final ambient = isDark ? 0.45 : 0.16;
final glowAlpha = isDark ? 0.30 : 0.22;
final dy = direction.dy;
final dx = direction.dx;
return [
// Tight contact shadow.
BoxShadow(
color: Colors.black.withValues(alpha: 0.06 * level),
offset: Offset(dx * 1, dy * 2),
blurRadius: 4 * level,
),
// Ambient depth.
BoxShadow(
color: Colors.black.withValues(alpha: ambient * 0.5 * level),
offset: Offset(dx * 8, dy * 12),
blurRadius: 28 * level,
spreadRadius: -6 * level,
),
// Colored glow halo.
BoxShadow(
color: color.withValues(alpha: glowAlpha * level),
offset: Offset(dx * 4, dy * 16),
blurRadius: 36 * level,
spreadRadius: -10 * level,
),
];
}