-
Notifications
You must be signed in to change notification settings - Fork 270
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
Set letter spacing to 1% in buttons #548
Comments
I am interested in working on this issue |
Hi @Gosplex, welcome. I think we're not going to want to do this by setting Instead, we'll use the "theme" features of Flutter's Material Design implementation. See Your first step will be to find the existing code in the app that works with those APIs, and start to get an idea of how you'd approach addressing this issue there. There's also several button-related "theme" classes, which control the text (and other things) in buttons specifically. So you'll want to find those and get an idea of how you'd address the buttons part of this issue using those. If you have any specific questions as you're exploring those, please go ahead and ask. Making a new thread in |
Yes Sure! |
This zeroes out the letter spacing in message content (zulip#545), and also everywhere else that uses styles from zulipTypography without overriding the letter spacing. It's worth mentioning that letter spacing is one of the parameters that are carefully chosen for the 15 TextThemes that make up the default Typography in Material 3: {display,headline,title,label,body} × {small,medium,large} So this might be considered a regression...if the Material spec were our primary or only source of truth for text styles. But it isn't: we have a designer (Vlad), and this change brings us closer to his specified design. See zulip#545 and zulip#548. I also checked to see if the Material 3 default varies the letter spacing among the three [ScriptCategory]ies (englishLike, dense, and tall), which might be a reason to ask Vlad if we want to do the same. But the letter-spacing values are the same across the [ScriptCategory]ies, so no need for that. After this, there's still more to do for zulip#548: - letter spacing of 1% (i.e., 0.01 times `fontSize`) in buttons - perhaps audit for UI code that's meant to follow Figma already, but where we failed to set a non-zero letter spacing that was specified in Figma Fixes: zulip#545 Fixes-partly: zulip#548
Good day |
This zeroes out the letter spacing in message content (zulip#545), and also everywhere else that uses styles from zulipTypography without overriding the letter spacing. It's worth mentioning that letter spacing is one of the parameters that are carefully chosen for the 15 TextThemes that make up the default Typography in Material 3: {display,headline,title,label,body} × {small,medium,large} So this might be considered a regression...if the Material spec were our primary or only source of truth for text styles. But it isn't: we have a designer (Vlad), and this change brings us closer to his specified design. See zulip#545 and zulip#548. I also checked to see if the Material 3 default varies the letter spacing among the three [ScriptCategory]ies (englishLike, dense, and tall), which might be a reason to ask Vlad if we want to do the same. But the letter-spacing values are the same across the [ScriptCategory]ies, so no need for that. After this, there's still more to do for zulip#548: letter spacing of 1% (i.e., 0.01 times `fontSize`) in buttons. Fixes: zulip#545 Fixes-partly: zulip#548
Cool, please go ahead. Note that part of this issue is now done, so the remaining part is the part about 1% letter spacing in buttons. For an example of how we adjust themes systematically, take a look at #549 and the file that PR modified. We'll need to do something similar for the button themes. |
@gnprice Sir |
It's a bit annoying that we have to repeat all of elevatedButtonTheme filledButtonTheme menuButtonTheme outlinedButtonTheme segmentedButtonTheme textButtonTheme but anyway, here we are; I don't think I've left any out. [ThemeData.buttonTheme] *sounds* like it might be one central place to define button text's letter spacing...but on a closer look, it doesn't allow setting letter spacing, and moreover it's deprecated, with these various FooButtonThemes meant to replace it. Fixes: zulip#548
It's a bit annoying that we have to repeat all of elevatedButtonTheme filledButtonTheme menuButtonTheme outlinedButtonTheme segmentedButtonTheme textButtonTheme but anyway, here we are; I don't think I've left any out. [ThemeData.buttonTheme] *sounds* like it might be one central place to define button text's letter spacing...but on a closer look, it doesn't allow setting letter spacing, and moreover it's deprecated, with these various FooButtonThemes meant to replace it. Fixes: zulip#548
It's a bit annoying that we have to repeat all of elevatedButtonTheme filledButtonTheme menuButtonTheme outlinedButtonTheme segmentedButtonTheme textButtonTheme but anyway, here we are; I don't think I've left any out. [ThemeData.buttonTheme] *sounds* like it might be one central place to define button text's letter spacing...but on a closer look, it doesn't allow setting letter spacing, and moreover it's deprecated, with these various FooButtonThemes meant to replace it. Empirically, the mark-all-as-read button (a [FilledButton.icon]) ignores the TextStyle in the ambient FilledButtonThemeData unless explicitly told to use it; that's because we use the `textStyle` param. So, explicitly merge that in, and adjust some tests (action_sheet_test, autocomplete_test, message_list_test) that weren't providing the FilledButtonThemeData so that they do provide it. ...hmm, but for that specific button, the Figma asks for a specific font size, which differs from the default `labelLarge`. That means we need to set `letterSpacing` right alongside `fontSize`, because the letter spacing should be proportional to the font size. Having done so, the restatement of the TextStyle in FilledButtonThemeData is now completely redundant. Shrug...I guess... if we add to those theme styles, we'll want them to be merged in, as done here, and that seems really easy to forget to do. Fixes: zulip#548
It's a bit annoying that we have to repeat all of elevatedButtonTheme filledButtonTheme menuButtonTheme outlinedButtonTheme segmentedButtonTheme textButtonTheme but anyway, here we are; I don't think I've left any out. [ThemeData.buttonTheme] *sounds* like it might be one central place to define button text's letter spacing...but on a closer look, it doesn't allow setting letter spacing, and moreover it's deprecated, with these various FooButtonThemes meant to replace it. Empirically, the mark-all-as-read button (a [FilledButton.icon]) ignores the TextStyle in the ambient FilledButtonThemeData unless explicitly told to use it; that's because we use the `textStyle` param. So, explicitly merge that in, and adjust some tests (action_sheet_test, autocomplete_test, message_list_test) that weren't providing the FilledButtonThemeData so that they do provide it. ...hmm, but for that specific button, the Figma asks for a specific font size, which differs from the default `labelLarge`. That means we need to set `letterSpacing` right alongside `fontSize`, because the letter spacing should be proportional to the font size. Having done so, the restatement of the TextStyle in FilledButtonThemeData is now completely redundant. Shrug...I guess... if we add to those theme styles, we'll want them to be merged in, as done here, and that seems really easy to forget to do. Fixes: zulip#548
TextTheme.labelLarge is the default label style in all the various Material buttons; see: [ElevatedButton.defaultStyleOf], [FilledButton.defaultStyleOf], [MenuItemButton.defaultStyleOf], [MenuItemButton.defaultStyleOf], [OutlinedButton.defaultStyleOf], `defaults` in [SegmentedButton.build], [TextButton.defaultStyleOf] . Since our buttons are all Material buttons, changing this will effectively "set letter spacing to 1% in buttons", which is zulip#548. (...Actually, I guess there's one kind of button that's not a Material button: reaction chips in the message list. So, adjust those separately, also in this commit.) Greg mentioned, when suggesting this approach, > In principle that has a slightly broader effect than specified in > zulip#548, in that it affects any other Material widgets that use the > `labelLarge` text style. But fundamentally those are widgets that > the Material designers intended to have a similar text style to > that of buttons (even though they're not called "buttons"), so > it's likely that that'll be the right answer anyway. > If we end up with such a widget where Vlad wants a different > spacing, we can address that then… and I think it's fairly likely > that in that case he'd want something that wasn't the Material > widget in any event. Which makes sense and works for me. Fixes: zulip#548
This is a followup to #545. That issue is focused on the one most conspicuous kind of text in the app; this one is for the rest of the app.
Specifically we want:
fontSize
) in buttons;(This part was handled in text: Set 0 letter spacing throughout zulipTypography #549.)letterSpacing: 0
everywhere else, except where the Figma design specifies otherwise.Chat thread.
The text was updated successfully, but these errors were encountered: