Add Horizontal Padding to Constrained Chip Label Calculations #31861
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently,
InputChipsdo not account for two things:_layoutLabelnow returns aSizethat is properly constrained if there is a finiteconstraint.maxWidth.I also found that existing tests in
chip_test.dartthat utilize the_testConstrainedLabelhave a brittle way of determining that aChipand its avatar, label or delete icon is properly constrained by its parent, as it just checks to see if the label and chip's width and height are less than or equal to it's parent's width and height, since this does not account for:After some investigation, a cleaner fix that lays out the above will be complex, so this PR resolves the immediate issue of constraining the label and delete icon to a match its parent. I will file issues to track this need.
TODO:
Related Issues
Fixes #31790
Fixes #11523
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
Does your PR require Flutter developers to manually update their apps to accommodate your change?