withStateLayer function
fill with its contrast-safe state layer (stateLayerColor) at
opacity composited on.
Implementation
Color withStateLayer(Color fill, Color label, double opacity) => opacity <= 0
? fill
: Color.alphaBlend(
stateLayerColor(fill, label).withValues(alpha: opacity.clamp(0.0, 1.0)),
fill,
);