disable method

Color disable(
  1. Color color, [
  2. Color? background
])

Returns a disabled variant of the color by multiplying its opacity by disabledOpacity.

Implementation

Color disable(Color color, [Color? background]) {
  final disabled = color.withValues(alpha: color.a * disabledOpacity);
  // This is required for cases where there are other elements beneath the disabled widget that would show through the
  // transparency, e.g. slider's active track and the ticks beneath it.
  return background == null ? disabled : Color.alphaBlend(disabled, background);
}