-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Add label widget parameter to InputDecoration #86810
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
Add label widget parameter to InputDecoration #86810
Conversation
…t-input-decoration
…atingLabelStyle overrides
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.
Some minor formatting problems here but otherwise looks good.
/// ); | ||
/// } | ||
/// ``` | ||
/// {@end-tool} |
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.
Good example!
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 👍
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
/// Text that describes the input field. | ||
/// Optional widget that describes the input field. | ||
/// | ||
/// {@macro flutter.material.inputDecoration.labelText} |
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.
Should this macro be named "..inputDecoration.label"?
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.
I agree with you. inputDecoration.label
sounds more appropriate since this is shared between label
and labelText
.
Thanks a lot!🙏 @Renzo-Olivares |
Description
This change adds a new parameter to InputDecoration for a custom label widget. Previously only labelText was available for the label which takes in a string, and uses labelStyle and floatingLabelStyle for its styling. If someone wanted to style part of the label differently then they were not able to do so. Adding a label widget gives the developer this flexibility.
Related Issues
Fixes #55285
Tests
I added the following tests:
Pre-launch Checklist
///
).