toButtonState method
HubbleButtonState
toButtonState({
- HubbleButtonState? defaultValue,
- HubbleButtonState? successValue,
- HubbleButtonState? errorValue,
Implementation
HubbleButtonState toButtonState({
HubbleButtonState? defaultValue,
HubbleButtonState? successValue,
HubbleButtonState? errorValue,
}) {
if (isInProgress) {
return HubbleButtonState.progress;
} else if (isFailed) {
return errorValue ?? HubbleButtonState.caution;
} else if (isSuccess) {
return successValue ?? HubbleButtonState.success;
} else {
return defaultValue ?? HubbleButtonState.enabled;
}
}