shadows method
Figma approximation of Material 3 elevation levels (M3 design kit).
Implementation
List<IrShadow> shadows(double elevation) {
if (elevation <= 0) return const [];
final (
keyY,
keyBlur,
ambientY,
ambientBlur,
ambientSpread,
) = switch (elevation) {
<= 1 => (1.0, 2.0, 1.0, 3.0, 1.0),
<= 3 => (1.0, 2.0, 2.0, 6.0, 2.0),
<= 6 => (1.0, 3.0, 4.0, 8.0, 3.0),
<= 8 => (2.0, 3.0, 6.0, 10.0, 4.0),
_ => (4.0, 4.0, 8.0, 12.0, 6.0),
};
final shadow = color('shadow');
return [
IrShadow(color: shadow.withAlpha(0.3), y: keyY, blur: keyBlur),
IrShadow(
color: shadow.withAlpha(0.15),
y: ambientY,
blur: ambientBlur,
spread: ambientSpread,
),
];
}