New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better textFormField label placement customization when focused and when value input- vertical floatingLabelAlignment feature. #110425
Comments
Hello @SexyBeast007. Thank you for filing this request. This issue goes against the Material guidelines for text fields you can find here. Since Flutter follows Material guidelines, this does not seem like a valid request to me. Therefore, I am closing this issue. If you disagree, please comment and we can reopen it. Thank you. |
@exaby73 Can you please tell me specifically what this proposal collides with in Material guidelines? I searched and couldn't find anything specific. As a matter of fact, my design is very similar to underline text fields in that the label floats up just above the input content. Surely a border around it all doesn't hinder anything that I could find. |
If you see the section on label text, you see 2 types of labels used, one with the filled text field which is similar to yours and one with the outline text field which cuts the top border of the text field. I am in no way an expert here, so I'll label this issue for further insights from the team. Thank you. |
Just curious how long it might take to have something like this implemented if is accepted? |
There any update on this issue? I am in a similar boat where design calls for the label to not overlap the border. |
I have a very similar issue to, but I've solved almost all of it, except one part that is hard coded deep in the flutter framework (which I've put in a pull request to parameterize). I'll share what I did here, but take a look at my issue: #130030. So I broke the problem down into 3 different problems.
My situation is easier because I don't have a (responsive) border to deal with. But my background is curved. So I made the TextField transparent and borderless. Then I wrap it in a The only thing I don't have control over here distance between the label and the text content. that's why I issued a pull request to parameterize that part. once that's accepted I'll be able to specify As you can see this is a piecemeal solution, which is never ideal, but sufficient. This isn't a whole perfect solution, but it solves the issue with minimal addition to (and no alteration of) the flutter framework.
|
This issue is missing a priority label. Please set a priority label when adding the |
This issue is assigned to @lastmeta but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks! |
For anyone who is curious, the reason this issue hasn't had activity is I'm too tired to fight for it. It's an (above all else) simple, but also easy, effective, and minimal solution. But person after person pushed back on it. Until finally someone suggested they know of a better (unarticulated and still yet unmaterialized) way to handle the situation altogether. Ok then. Congrats, the bureaucracy won, my many hours of effort to implement a tiny improvement to the code base, amounting to essentially one line of code was simply no match for the it! |
For those who might encounter a similar issue, here is my workaround. I created my implementation of I hope this solution can be convenient as it doesn't introduce any additional wrappers and can be used quite universally. For example, you can use this There are relatively few differences from the |
Use case
I want some fine tuned, detailed customization for my textFormField. Currently, when the field becomes focused (and permanently when a value is input) the floating label floats up to the border & cuts it. The label sits vertically in the centre of the border and the label cuts the border. While this does look okay for some field configurations, such as some rectangular fields, it looks horrible for others. Specifically mine looks gross. I have a beautiful design from my designer and I want to keep with this.
This is a problem for me and my design, not specifically a problem with the textFormField.
Haven't found a package that does this but, here is some code that does solve this problem. It is a bit of a hack because it requires external state and container wrapping logic to exteriorly handle a textFormFields border outline. This is definitely NOT OPTIMUM and I do NOT want to have to use this solution. The full SO post can be found here.
Please take note that the label "Amount" floats to the TOP of the textFormField but does NOT touch or intercept the top border. This is EXACTLY what I would want and I think could be very useful. While this works, the code is hacky and not streamlined. This would also not work with theme for Outline borders for error, at least without the state that is proposed in the hacky solution.
The hacky solution looks like this, PLEASE NOTE, this is exactly what is desired effect visually and functionally but the code aspect needs working into the very fabric of the textFormField API.
[
Here is the default field behaviour and what I DO NOT WANT, please notice how the label cuts the border and is moved too high. 🤮
[
Proposal
Here is my design example:
<!--
The solution I can see (non code descriptive) is to provide a verticalFloatingAlignment property to customize the height the label floats to when focused or filled out. This would also require the textFormFields content to be slightly lower than normal to allow space for the floating label to share space in an aesthetic fashion.
No package does this that I could find.
Also this is very much the same issue/feature request. It has been closed and looks to be HUGELY misunderstood. The issue has NOT been solved and the feature does NOT exist.
Thank you for taking the time to help with this feature.
The text was updated successfully, but these errors were encountered: