-
Notifications
You must be signed in to change notification settings - Fork 28.7k
Fix body1/body2 for 2018 Material Design (#38904). #47918
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
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Even though no tests failed, this is probably a breaking change as existing apps will look a bit different after this is merged |
@Zazo032 Hence the quotation marks I added around "not a breaking a change" from the template (which seemed to consider that statement to be an implication) ;P. The issue is that this is a bug which makes this mechanism useless, and as I mentioned it seems like no one is really trying to use it (as it is not obvious that you need to do this... using the 2018 sizes should probably be part of the new project template to ensure anyone actually notices it has to be done)... if nothing else so few people have noticed this bug. Leaving this broken just makes this entire thing even less usable. |
We're planning to update the TextTheme's text style names per the current Material spec: #45745. I'm going to close this PR, as the project is already being actively worked on. Thanks for you contribution and for the passionate write-up! |
@HansMuller I just reviewed the patch and discussion in #45745, and I am concerned that the names are being fixed but the table is not; like; if you want to correctly get Material 2018 using @Hixie's patch (which does correctly flip the names) you also separately need to commit my patch (to make the table put the correct font sizes to the correct entries). Are you sure this isn't going to be forgotten when the table's names are updated? |
We should add a test before landing this, though. |
@saurik per #47918 (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.
It looks like we may have overlapping work here with #51513, @HansMuller was this also a potential breaking change?
We haven't pursued this change yet because it will break existing layouts and golden image tests. |
I'm going to close this in favor of #49756 - which makes the very same change. To my surprise, these changes did not break existing tests (at least not as far as I've been able to tell). I will try and land them now. |
Description
In 2018, Material Design did a major update to its typography, renaming all of its styles as well as changing all of their default sizes and weights. One notable aspect of this change is that what used to be body1 is best mapped to what is now body2. While Flutter has decided to enshrine for all eternity the old naming scheme, it has provided new TextTheme variants for the 2018 styles. These were, correctly, documented to swap body1 and body2 (which is the same behavior that was used for React Native). However, while as far as I can tell (based on relative sizing), this was done correctly for the "dense" and "tall" variants, the swap was not done for the englishLike variant. Without this swap, the 2018 typography is incompatible with all of the existing code that is using body1 as the default size.
Of course, fixing this will, I would expect, break people who have added one-off adjustments to their font sizes in an attempt to work around this bug, but 1) it was documented correctly (so I would hope that if anything this helps people and fixes things that were slightly broken before), 2) the englishLike variant is the only one that is broken (so workarounds are going to either be crazy or incomplete), 3) workarounds likely would have just further broken existing code (as the existing code would be assuming body1 is the default), and 4) because Flutter has decided to maintain the 2014 styles as the default--despite now being almost two years out of date--it is unlikely that many people even ever discovered that to get the correct/modern sizes they would need to switch to this broken TypeTheme anyway: so, really, anything that would make this path more usable seems like a positive thing to get done ASAP.
Related Issues
Months ago, someone reported this issue as #38904.
Tests
Any test for this would just be a second copy of the same table verifying the data from the first copy, which would be pointless. FWIW, I did run the existing test suites in packages/flutter and examples/flutter_gallery and none of them noticed.
Checklist
///
).flutter analyze --flutter-repo
) does not report any problems on my PR.Breaking Change