HubbleButton.verbose constructor

HubbleButton.verbose({
  1. required Widget child,
  2. required VoidCallback onPressed,
  3. required HubbleButtonSize size,
  4. bool isInProgress = false,
  5. bool isEnabled = true,
  6. bool isGhost = false,
  7. bool isOutlined = false,
  8. bool isExpanded = false,
  9. ButtonTapEvent? buttonTapEvent,
  10. Color? background,
  11. Color? foreground,
})

Implementation

factory HubbleButton.verbose({
  required Widget child,
  required VoidCallback onPressed,
  required HubbleButtonSize size,
  bool isInProgress = false,
  bool isEnabled = true,
  bool isGhost = false,
  bool isOutlined = false,
  bool isExpanded = false,
  ButtonTapEvent? buttonTapEvent,
  Color? background,
  Color? foreground,
}) {
  if (!isEnabled) {
    return HubbleButton(
      onPressed: onPressed,
      size: size,
      isGhost: isGhost,
      isOutlined: isOutlined,
      state: HubbleButtonState.disabled,
      width: isExpanded ? double.infinity : null,
      tapEvent: buttonTapEvent,
      background: background,
      foreground: foreground,
      child: child,
    );
  }

  if (isInProgress) {
    return HubbleButton(
      onPressed: onPressed,
      size: size,
      isGhost: isGhost,
      isOutlined: isOutlined,
      state: HubbleButtonState.progress,
      tapEvent: buttonTapEvent,
      background: background,
      foreground: foreground,
      child: child,
    );
  }

  return HubbleButton(
    onPressed: onPressed,
    size: size,
    isGhost: isGhost,
    isOutlined: isOutlined,
    state: HubbleButtonState.enabled,
    tapEvent: buttonTapEvent,
    background: background,
    foreground: foreground,
    child: child,
  );
}