getBackground method

Color getBackground(
  1. BuildContext context,
  2. OwlnextButtonState state
)

Implementation

Color getBackground(BuildContext context, OwlnextButtonState state) {
  if (state.widget.customType != null) {
    return state.widget.customType!.backgroundColor;
  } else {
    switch (state.widget.type) {
      case ButtonType.classic:
        return Theme.of(context).colorScheme.primary;
      case ButtonType.delete:
        return Theme.of(context).colorScheme.onError;
      case ButtonType.save:
        return Theme.of(context).colorScheme.onPrimary;
      case ButtonType.primary:
        return Theme.of(context).colorScheme.primary;
      case ButtonType.secondary:
        return Theme.of(context).colorScheme.secondary;
      case ButtonType.tertiary:
        return Theme.of(context).colorScheme.tertiary;
      case ButtonType.error:
        return Theme.of(context).colorScheme.error;
      // ignore: unreachable_switch_default
      default:
        return Theme.of(context).colorScheme.primary;
    }
  }
}