Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Fixed space between two TextFormField on Flutter

I’m trying to create an app for my work with login and signup form.

The page is ok, but there is a litte problem: on each TextFormField there is a validator for check the field, but when appears the error message below the field, the other fields goes down.

The question is: how can I fix the textfields?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

This is a gif demostration: https://ibb.co/VwNn2f0

I try to use padding or other method finded here or on google, but I didn’t find a solution.

>Solution :

you could wrap your TextField with a SizedBox and set a height for it :

SizedBox(
  height: 80,
  child: TextFormField(
    validator: myValidator,
  ),
),

or you can also set a style for the error text, with a 0 height :

TextField(
  decoration: InputDecoration(
    errorStyle: TextStyle(height: 0),
  ),
);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading