calculateBackgroundColor function

Color calculateBackgroundColor(
  1. Color backgroundColor, {
  2. bool isActive = false,
  3. bool isDisabled = false,
  4. bool isPlain = false,
})

Implementation

Color calculateBackgroundColor(
  Color backgroundColor, {
  bool isActive = false,
  bool isDisabled = false,
  bool isPlain = false,
}) {
  if (isPlain) {
    if (isDisabled) {
      return backgroundColor.withValues(alpha: 0.1);
    }
    if (isActive) {
      return backgroundColor.withValues(alpha: 0.8);
    }
    return backgroundColor.withValues(alpha: 0.1);
  } else {
    if (isDisabled) {
      return backgroundColor.withValues(alpha: 0.4);
    }
    if (isActive) {
      return backgroundColor.withValues(alpha: 0.8);
    }
    return backgroundColor;
  }
}