-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Show hint when label is floating #60394
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
Show hint when label is floating #60394
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I wasn't able to find anything on material.io that talks about this specific behavior though?
// If we're not focused, there's no value, labelText was provided, and | ||
// floatingLabelBehavior isn't set to always, then the label appears where the | ||
// hint would. | ||
bool get _hasInlineLabel => !widget._labelShouldWithdraw |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the line is getting a bit too long. Maybe convert this to use curly brackets?
Started Google testing for this PR |
Started Google testing for this PR |
Google testing passed! |
1 similar comment
Google testing passed! |
Started Google testing for this PR |
Google testing passed! |
@LongCatIsLooong I couldn't find any specific guidelines about this behavior either. It seems weird to me that the hint would suddenly appear on focus, but I wasn't able to prove that that's what the Material spec wants either. I'll try to ask someone from Material. |
Started Google testing for this PR |
Google testing passed! |
I'm going to move forward with this since I haven't been able to get any definitive answer from Material. My best judgement says it should work like it does in this PR. I'll be prepared to change this back if I hear otherwise. |
So excited to see this :) |
is this on stable channel yet? |
Yes, as of the 1.20.0 release that just came out today! |
Description
Previously, hint wasn't showing when floatingLabelBehavior was
always
, even though it had room. It only showed when focused:This PR makes it show even when not focused.
Related Issues
Closes #60292
Closes #53753
Tests
I added the following tests:
Render an InputDecorator with
floatingLabelBehavior: FloatingLabelBehavior.always
and expect the hint to be visible even when it is not focused.