gradientFrom static method
Build a vivid two-stop gradient from any base color (for caller-supplied
custom colors, e.g. a dialog driven by colorScheme.primary).
Implementation
static LinearGradient gradientFrom(Color base) {
final hsl = HSLColor.fromColor(base);
final start = hsl
.withLightness((hsl.lightness + 0.08).clamp(0.0, 1.0))
.withSaturation((hsl.saturation + 0.05).clamp(0.0, 1.0))
.toColor();
final end = hsl
.withLightness((hsl.lightness - 0.12).clamp(0.0, 1.0))
.withSaturation((hsl.saturation + 0.08).clamp(0.0, 1.0))
.toColor();
return LinearGradient(
begin: .topLeft,
end: .bottomRight,
colors: [start, end],
);
}