foreground method

Color foreground({
  1. required BuildContext context,
  2. required bool isFocused,
  3. required bool isPressed,
  4. required bool isDisabled,
  5. required bool isActive,
})

Implementation

Color foreground({
  required BuildContext context,
  required bool isFocused,
  required bool isPressed,
  required bool isDisabled,
  required bool isActive,
}) {
  switch (this) {
    case OneButtonHierarchy.primary:
      return OneColors.white;
    case OneButtonHierarchy.secondaryGray:
      return context.color.foreground(ForegroundColorType.secondaryHover);
    case OneButtonHierarchy.secondaryColor:
      return context.color.foreground(ForegroundColorType.brandPrimary);
    case OneButtonHierarchy.tertiaryGray:
      return context.color.foreground(ForegroundColorType.tertiary);
    case OneButtonHierarchy.tertiaryColor:
      return context.color.foreground(ForegroundColorType.brandPrimary);
    case OneButtonHierarchy.linkGray:
      if (isActive) {
        return context.color.foreground(ForegroundColorType.primary);
      }
      return context.color.foreground(isFocused
          ? ForegroundColorType.primary
          : ForegroundColorType.tertiary);
    case OneButtonHierarchy.linkColor:
      return context.color.foreground(ForegroundColorType.tertiaryHover);
  }
}