-
Notifications
You must be signed in to change notification settings - Fork 29.7k
[Material 3] Update TextTheme to have M3 names for styles #93725
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
|
Since you are refactoring everything, can you also make them non-nullable? This would be a breaking change I guess, but people are postponing this for a while. |
guidezpl
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.
_ ___ _____ __ __
| | / __|_ _| \/ |
| |_| (_ | | | | |\/| |
|____\___| |_| |_| |_|
Although I'd like to do this, that would be a pretty large breaking change for everyone, so we'll have to defer that for now. |
Technically it wouldn't be a breaking change because AFAIK text just can't be null. It is never null. It was made nullable kind of temporarily until 2014 styles were removed (which already were), and then no one made them non-nullable. But there is nothing they would break, they would just throw warnings everywhere because |
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.
This looks good modulo the font-size changes that maybe I'm mistaken about?
Although this change is non-breaking, we will need a migration guide that explains what's changing and the rationale for what's changing.
| labelLarge = labelLarge ?? button, | ||
| labelSmall = labelSmall ?? overline; | ||
|
|
||
| /// Large size of the display styles. |
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.
Are we really helping anyone with comments like this? There must be a reason for calling some of the fonts "display". Presumably it has something to do with using them for short standalone text that's not a title (whatever that is). As far as the "large" qualifier goes, it would be worth characterizing this TextStyle as the largest.
Here and below.
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.
Hmm yeah its tricky to describe these styles, I copied the descriptions from https://m3.material.io/styles/typography/applying-scaling-type for each category (and put it in the 2nd sentence of each comment) and then I updated to use largest, smallest, etc. Let me know what you think?
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 descriptions look good.
| TextStyle? overline, | ||
| }) { | ||
| assert( | ||
| (displayLarge == null && displayMedium == null && displaySmall == null && headlineMedium == null && |
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 realize that there's no nice and compact way to format this, but: two-space indent
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.
Fixed
| displayLarge : TextStyle(debugLabel: 'englishLike displayLarge 2014', inherit: false, fontSize: 112.0, fontWeight: FontWeight.w100, textBaseline: TextBaseline.alphabetic), | ||
| displayMedium : TextStyle(debugLabel: 'englishLike displayMedium 2014', inherit: false, fontSize: 56.0, fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic), | ||
| displaySmall : TextStyle(debugLabel: 'englishLike displaySmall 2014', inherit: false, fontSize: 45.0, fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic), | ||
| headlineLarge : TextStyle(debugLabel: 'englishLike headlineLarge 2014', inherit: false, fontSize: 40.0, fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic), |
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.
Is this supposed to be backwards compatible with headline4? The font sizes do not match. Likewise for some of the following text styles
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.
Actually headline4 maps to headlineMedium, headlineLarge is a new style with no mapping to an old one (so is labelMedium). The diff is tricky to follow since I had to reorganize some lines to be more readable.
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.
OK. The migration guide should make the mapping from old names to new ones clear.
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
Summary
This change adds the Material 3 text style names to the
TextThemeAPI. It includes renames of all 2018 text styles and the introduction of 2 more styles for a total of 15. The 2018 names will be deprecated later on, once Material 3 is fully implemented.Part of #89853 (fixes #89853)
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.