getDisabledColor method

Color? getDisabledColor(
  1. BuildContext context, {
  2. FastButtonEmphasis? emphasis,
  3. bool isEnabled = true,
  4. Color? disabledColor,
  5. Color? color,
  6. Widget? icon,
})

Implementation

Color? getDisabledColor(
  BuildContext context, {
  FastButtonEmphasis? emphasis,
  bool isEnabled = true,
  Color? disabledColor,
  Color? color,
  Widget? icon,
}) {
  if (disabledColor != null) return disabledColor;
  if (color != null) return color.withAlpha(kDisabledAlpha);

  if ((icon is FaIcon) && icon.color != null) {
    return icon.color!.withAlpha(kDisabledAlpha);
  }

  if ((icon is Icon) && icon.color != null) {
    return icon.color!.withAlpha(kDisabledAlpha);
  }

  return getEmphasisedColor(context, emphasis: emphasis)
      ?.withAlpha(kDisabledAlpha);
}