TextFormField, Validation and Widget Jumping

Hi all,

Apologies if this has been asked before.. I have signed up in desperation as I can’t find a reliable solution. Is there a way I can use Form validation with the TextFormField widget, that triggers validation but completely disables the error text (and therefore stops the display jumping when an error occurs)?

I am currently using:
TextFormField
(
validator: ‘’ // returns no string, but triggers validation error state
errorStyle: TextStyle(height: 0, fontSize: 0) // sets size of error text as minimal as possible, but still results in slight jump
)

Ideally I would like to roll my own validation code, that still triggers Form validation, and then handle painting the border of the form widget a chosen colour myself.

Kind regards,

Ben.

errorBuilder: (context, errorText) => Container(height: 0)), something like this, it still paints the line red under the field, I think you can disable that too somewhere

1 Like

Thanks @mihalycsaba, that solution is absolutely perfect!!

Kind regards,

Ben.

I never did this before either. It’s always a good idea to take a look at the docs TextFormField class - material library - Dart API

Usually these builder things will build you some widget, I think you could also include some functions here if needed, not sure if it’s a good practice, but you could do it.