-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix Vertical Alignment Regression #34859
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
Fix Vertical Alignment Regression #34859
Conversation
HansMuller
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.
LGTM
| // | ||
| // That means that if the padding is uneven, center is not the exact | ||
| // midpoint of top and bottom. To account for this, the points are | ||
| // interpolated between independently. |
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.
the above center and below center alignments are interpolated independently
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.
Thanks, I was struggling to not say "we" or "I" in this sentence haha.
| } | ||
|
|
||
| // Interpolate between three stops using textAlignVertical. This is used to | ||
| // calculate the outline baseline, which ignores padding for its middle but |
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.
ignores padding when the alignment is middle and interpolates between the centered text box's top and the top of the content padding when the alignment is less than zero [etc...]
| if (textAlignVertical.y <= 0) { | ||
| // It's possible for begin, middle, and end to not be in order because of | ||
| // excessive padding. Those cases are handled by using middle. | ||
| if (begin >= middle) { |
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.
NICE catch
|
@justinmc I'm not really sure how, but is it possible that this change caused webview_flutter to no longer vertically center web content correctly? This seems to have started with 1.7.6 and is fine in 1.7.5. Simple example with a webview going to a page with vertical centering. 1.7.5 shows correctly and 1.7.6 pushes everything to the top. |
|
Weird, I wouldn't think so... @collinjackson is it possible there is any connection between InputDecorator alignment and webview_flutter? |
Change the way outlined inputs vertically align their text to be more similar to how it used to be before a refactor. Fixes an edge case uncovered by a SCUBA test.
This fixes a regression found while doing the roll where inputs with OutlineInputBorder and symmetrical padding don't center. This was caused by #34355.
The solution here is to treat OutlineInputBorder differently (as it was before the referenced PR) so that it ignores padding when centering, but considers padding when aligning elsewhere.