Repository navigation
Implement VisualDensity for text fields. - #51438
Conversation
justinmc
left a comment
There was a problem hiding this comment.
LGTM
Some questions about the larger state of InputDecorator though. How does this fit in with isDense and InputDecoration.collapsed? Do they all still have valid reasons to coexist as-is? There is an issue open about collapsed being broken right now, so I am thinking about how to fix that as well: #46160
There was a problem hiding this comment.
Nit: Maybe put spaces around the /.
There was a problem hiding this comment.
I hope all of these calculations made sense to you by the way! I tried to clean up this method awhile back, but it's still fairly long and confusing.
There was a problem hiding this comment.
(fixed the spaces) Yeah, the names of the variables were pretty helpful in figuring out where to add the offset. It's still pretty confusing to me, but I think they're in the right places.
ffd26e3 to
0487b10
Compare
|
I think The density API won't change the padding or the text size, it will just change some of the constraints and offsets. For text fields, it only affects vertical size. |
|
|
|
Ahh, OK, I guess I'm mistaken about |
|
@HansMuller @gspencergoog The issue about I looked through the code for what However, I think it could be done by manually setting |

Description
This implements
VisualDensitychanges for text fields*. By default, the layout of the text field does not change.If the
ThemeData.visualDensityis set to a value other than zero, then the density of the UI will increase or decrease. See theVisualDensitydocs for more information.Here's a GIF of the
compact,comfortable, andstandarddensities with an outline, underline, and multiline text field:(*In reality, the changes are on the
InputDecoratorclass, not on the text field.)I also fixed a problem that I think I found with
_Decorationwhere it doesn't compareisDenseorisCollapsedas part of itsoperator==.Related Issues
Tests
Breaking Change