-
Notifications
You must be signed in to change notification settings - Fork 29.8k
InputDecorator prefixIconConstraints and suffixIconConstraints #50058
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
InputDecorator prefixIconConstraints and suffixIconConstraints #50058
Conversation
gspencergoog
left a comment
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.
About the splitting into prefix and suffix: since everything else is split that way, I think it makes sense to also split it that way.
| /// setting the constraints' minimum height and width to a value lower than | ||
| /// 48px. | ||
| /// | ||
| /// ```dart |
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.
Ideally, this would be an actual {@tool dartpad ...} sample so that people could see it in action and play with it in the web page.
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 decided to give it a whirl since I've never tried it :)
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.
Although I noticed that testing the new feature in a new DartPad instance didn't work because the parameters did not exist on whatever version of Flutter that DartPad uses (I'm guessing stable), so we'll have no guarantee that it'll work via the instructions in snippets/README.md
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.
It will work once DartPad picks up the changes, which should happen in a couple of weeks or so.
Description
Introduces two new parameters that allow the BoxConstraints of the InputDecoration's prefixIcon and suffixIcon to be modifiable. This is particularly useful when
isDenseis set to true, which allows the icon sizes to be smaller than 48x48px.Example:

Sample Code:
Alternative considered
This seems to be a tad verbose to define the box constraints separately for prefix and suffix icons. It could simply be controlled by one parameter (ie.
iconConstraints). That makes the constraints less flexible since both icons will share the same set of constraints, but if that seems like a more favorable API, please comment on the PR, but I decided to choose flexibility for now. Thanks!Related Issues
Fixes #21908
Tests
I added the following tests:
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.