invalidate method
void
invalidate(})
Invalidate field with a errorText
Focus field if shouldFocus
is true
.
By default true
Auto scroll when focus invalid if shouldAutoScrollWhenFocus
is true
.
By default false
.
Note: If a invalid field is from type TextField and will focused,
the form will auto scroll to show this invalid field.
In this case, the automatic scroll happens because is a behavior inside the framework,
not because shouldAutoScrollWhenFocus
is true
.
Implementation
void invalidate(
String errorText, {
bool shouldFocus = true,
bool shouldAutoScrollWhenFocus = false,
}) {
setState(() => _customErrorText = errorText);
validate(
clearCustomError: false,
autoScrollWhenFocusOnInvalid: shouldAutoScrollWhenFocus,
focusOnInvalid: shouldFocus,
);
}