You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TextFields (and TextFormFields) should allow displaying error state without error text #54104
There are occasions where multiple TextField (or more likely TextFormField) are used on a page and the UX could call for a custom error solution instead of each textfield displaying an error message. We want to maintain the validate logic that exists on the Form but allow the developer to decide whether each textfield should show its error text.
Proposal
Adding a new parameter to InputDecoration that tells TextFields they should not display their error text but still display any other error specific content (errorBorder, etc)
This would have to also work with the validate logic of TextFormField as well so that if a form is validated the error text can choose to not be displayed on each text field.
The workaround from @MichaelPriebe has a problem: it causes an empty space to appear under the textfield (where the error used to be). I would be nice to have a solution without this space.
Reacted by homely, Fernando Rosentalski, Franco Aparicio and Thiago Carvalho
The workaround from @MichaelPriebe has a problem: it causes an empty space to appear under the textfield (where the error used to be). I would be nice to have a solution without this space.
Try this: TextStyle(height: 0.01), I get it working here with master.
The workaround from @MichaelPriebe has a problem: it causes an empty space to appear under the textfield (where the error used to be). I would be nice to have a solution without this space.
Try this: TextStyle(height: 0.01), I get it working here with master.
Thank you this worked by using 0.001 however this is a very ugly solution.
We need a real solution to lose error text and prevent text field outline getting shorter height.
It is crazy such a simple thing is not still solved.
Similar problem here on web platform:
The TextFormField on the left is using the "0.01" workaround, and the one on the right is using the TextStyle(height: 0) solution (which I'm pretty sure it worked fine some time ago, as I used it in another project of mine)
Activity
mikuhl-dev commentedon Apr 6, 2020
This is something I do too! Right now this is how I do it:
And then error for the validator is simply an empty string. So when there is an error all that is shown is the red error line.
rami-a commentedon Apr 6, 2020
yup I'm using this workaround for now as well but it would be nice to have a more formal way to support this.
roti commentedon Mar 21, 2021
The workaround from @MichaelPriebe has a problem: it causes an empty space to appear under the textfield (where the error used to be). I would be nice to have a solution without this space.
talski commentedon Aug 6, 2021
Try this:
TextStyle(height: 0.01), I get it working here with master.aytunch commentedon Dec 17, 2021
Thank you this worked by using 0.001 however this is a very ugly solution.
We need a real solution to lose error text and prevent text field outline getting shorter height.
It is crazy such a simple thing is not still solved.
Lorenzohidalgo commentedon Feb 9, 2022
Thanks! using
TextStyle(height: 0.001)worked to hide the error message.It would be nice to be able to decide how to show the error message from the different options:
boganiLuca commentedon Feb 2, 2023
Similar problem here on web platform:

The
TextFormFieldon the left is using the "0.01" workaround, and the one on the right is using theTextStyle(height: 0)solution (which I'm pretty sure it worked fine some time ago, as I used it in another project of mine)jbryanh commentedon Aug 27, 2023
In conjunction with this, an errorLabelTextStyle property seems reasonable.
flutter-triage-bot commentedon Oct 23, 2023
This issue is missing a priority label. Please set a priority label when adding the
triaged-designlabel.