[Error Icon]: error icon on the error message left side #1320
-
Beta Was this translation helpful? Give feedback.
Answered by
deandreamatias
Dec 22, 2024
Replies: 1 comment
-
Currently can't do it, because flutter_form_builder use errorText. You have two alternatives:
FormBuilderTextField(
autovalidateMode: AutovalidateMode.always,
name: 'age',
decoration: InputDecoration(
labelText: 'Age',
suffixIcon: _ageHasError
? const Icon(Icons.error, color: Colors.red)
: const Icon(Icons.check, color: Colors.green),
),
onChanged: (val) {
setState(() {
_ageHasError =
!(_formKey.currentState?.fields['age']?.validate() ??
false);
});
},
// valueTransformer: (text) => num.tryParse(text),
validator: FormBuilderValidators.compose([
FormBuilderValidators.required(),
FormBuilderValidators.numeric(),
FormBuilderValidators.max(70),
]),
), |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
deandreamatias
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently can't do it, because flutter_form_builder use errorText.
You have two alternatives: