EasyForms

class EasyForms

A class that manage all your forms states. Always create one instance per ViewModel or Compose screen.

Functions

addAndGetCustomState
Link copied to clipboard
fun <ST, CT, S : EasyFormsState<ST, CT>> addAndGetCustomState(key: Any, state: S): S
Create or Get a custom state provided by you.
formData
Link copied to clipboard
fun formData(): List<EasyFormsResult>
formKeys
Link copied to clipboard
fun formKeys(): List<Any>
formStates
Link copied to clipboard
fun formStates(): List<MutableState<EasyFormsErrorState>>
getCheckboxState
Link copied to clipboard
fun getCheckboxState(key: Any, defaultValue: Boolean = false, isRequired: Boolean = true): EasyFormsCheckboxState
Create or Get a state that handle Checkbox.
getRadioButtonState
Link copied to clipboard
fun getRadioButtonState(key: Any, defaultValue: Boolean = false, isRequired: Boolean = true): EasyFormsRadioButtonState
Create or Get a state that handle RadioButton.
getRangeSliderState
Link copied to clipboard
fun getRangeSliderState(key: Any, defaultValue: ClosedFloatingPointRange<Float> = 0F..0F, isRequired: Boolean = true): EasyFormsRangeSliderState
Create or Get a state that handle RangeSlider.
getSliderState
Link copied to clipboard
fun getSliderState(key: Any, defaultValue: Float = 0F, isRequired: Boolean = true): EasyFormsSliderState
Create or Get a state that handle Slider.
getSwitchState
Link copied to clipboard
fun getSwitchState(key: Any, defaultValue: Boolean = false, isRequired: Boolean = true): EasyFormsSwitchState
Create or Get a state that handle Switch.
getTextFieldState
Link copied to clipboard
fun getTextFieldState(key: Any, easyFormsValidationType: EasyFormsValidationType, defaultValue: String = ""): EasyFormsTextFieldState
Create or Get a state that handle TextField.
getTriCheckboxState
Link copied to clipboard
fun getTriCheckboxState(key: Any, defaultValue: ToggleableState = ToggleableState.Indeterminate, isRequired: Boolean = true): EasyFormsTriCheckboxState
Create or Get a state that handle TriStateCheckbox.
observeFormStates
Link copied to clipboard
fun observeFormStates(): State<List<MutableState<EasyFormsErrorState>>>
This method is useful when you only want to enable/disable your CTA until all required fields are Valid.

Sources

androidJvm source
Link copied to clipboard