Skip to content

text: Convert the last uses of FontWeight.bold to weightVariableTextStyle #728

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

Merged

Conversation

chrisbobbe
Copy link
Collaborator

(That is, the last uses except the ones in code-block styles, which are treated in #727.)

Before After
6EEB5903-E8FC-46D4-84CE-083ACE1C1E59 2CF00F52-126B-4950-88A8-69E65A531044
2F7D6B2C-E328-4AE5-AC0A-2CE5AEB23A7A C8BDEB92-A391-4316-AB36-6EED5586DCFE
56A0F77C-578E-4D22-8A30-7D4AEFD26450 C0EF8351-7DFD-4CAC-B7AE-3049A039E5A7

@chrisbobbe chrisbobbe added the integration review Added by maintainers when PR may be ready for integration label Jun 7, 2024
@chrisbobbe chrisbobbe requested a review from gnprice June 7, 2024 18:46
@alya
Copy link
Collaborator

alya commented Jun 7, 2024

Should we give more space to the labels in the profile screen? It seems unnecessary to make not particularly long labels spill onto two lines.

Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This answers exactly the question that came to mind when I was reviewing #727. 🙂

Code all looks good, with small comments below.

Comment on lines 16 to 22
static const primaryFieldText = TextStyle(fontSize: 20);
static const customProfileFieldLabel = TextStyle(fontSize: 15, fontWeight: FontWeight.bold);
static TextStyle customProfileFieldLabel(BuildContext context) =>
const TextStyle(fontSize: 15)
.merge(weightVariableTextStyle(context, wght: 700));
static const customProfileFieldText = TextStyle(fontSize: 15);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: blank lines to separate, since these are no longer one line each

@@ -1351,8 +1360,5 @@ InlineSpan _errorUnimplemented(UnimplementedNode node) {
}
}

const errorStyle = TextStyle(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

content [nfc]: Move codeStyle to ContentTheme

Do you mean s/codeStyle/errorStyle/?

Comment on lines 1363 to 1364
final errorCodeStyle = kMonospaceTextStyle
.merge(const TextStyle(fontSize: kBaseFontSize, color: Colors.red));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move this at the same time? Seems like we'll need to move it too for dark mode; and in any case it's closely related to errorStyle, so it seems like both of them are easier to understand if they're defined next to each other.

@gnprice
Copy link
Member

gnprice commented Jun 8, 2024

Should we give more space to the labels in the profile screen? It seems unnecessary to make not particularly long labels spill onto two lines.

Yeah, that'd likely be a good change.

We might also try turning the weight down a little on the labels, like perhaps to 600 instead of 700.

In general this is a screen that's not yet based on any design from Vlad; I think there wasn't one in the Figma document when Shu was building this screen, so we just made something similar to what zulip-mobile has. So we can make tweaks where we think there are easy improvements, but we don't need to spend time trying to really dial it in. At some point in the future, Vlad will design this screen as a whole, and then we'll revise it to implement that.

@chrisbobbe chrisbobbe force-pushed the pr-weight-variable-text-style-last-conversions branch from fe76fae to ea62232 Compare June 13, 2024 17:12
chrisbobbe added a commit to chrisbobbe/zulip-flutter that referenced this pull request Jun 13, 2024
Now, this text is styled with a `wght` value of 700, instead of 400
from the ambient style. The FontWeight.bold seems to have already
been causing the spans to render more boldly than surrounding text,
but in a way that doesn't match what we get for Source Code Pro with
`wght` 700. I think this is because of
  flutter/flutter#136779
.

The slightly changed appearance is making some profile field labels
run onto two lines on my device on CZO, instead of just one line, as
Alya pointed out:
  zulip#728 (comment)
So I'll follow up by giving those labels a bit more horizontal room.
chrisbobbe added a commit to chrisbobbe/zulip-flutter that referenced this pull request Jun 13, 2024
@chrisbobbe
Copy link
Collaborator Author

main after wghtVariableTextStyle after increasing horizontal space
6EEB5903-E8FC-46D4-84CE-083ACE1C1E59 2CF00F52-126B-4950-88A8-69E65A531044 C245D4CF-32A2-42DF-A3BA-6B59EC01913D

@chrisbobbe
Copy link
Collaborator Author

Thanks! Revision pushed.

Now, this text is styled with a `wght` value of 700, instead of 400
from the ambient style. The FontWeight.bold seems to have already
been causing the spans to render more boldly than surrounding text,
but in a way that doesn't match what we get for Source Code Pro with
`wght` 700. I think this is because of
  flutter/flutter#136779
.

The slightly changed appearance is making some profile field labels
run onto two lines on my device on CZO, instead of just one line, as
Alya pointed out:
  zulip#728 (comment)
So I'll follow up by giving those labels a bit more horizontal room.
Now, this text is styled with a `wght` value of 700, instead of 400
from the ambient style. The FontWeight.bold seems to have already
been causing the spans to render more boldly than surrounding text,
but in a way that doesn't match what we get for Source Code Pro with
`wght` 700. I think this is because of
  flutter/flutter#136779
.

We could probably have left out the `const TextStyle().merge()`; I
think the only difference it causes is in the resulting style's
debugLabel. But I figured we might as well be consistent in how we
use weightVariableTextStyle, and in any case it should disappear
with
  flutter/flutter#148026 .
This converts the last remaining place where we were using
TextStyle.fontWeight directly, when we should have been using
weightVariableTextStyle.

(In a future with
  flutter/flutter#148026
, though, we'll want to change all uses of weightVariableTextStyle
back to plain TextStyle.fontWeight.)

Now, this text is styled with a `wght` value of 700, instead of 400
from the ambient style. The FontWeight.bold seems to have already
been causing the spans to render more boldly than surrounding text,
but in a way that doesn't match what we get for Source Code Pro with
`wght` 700. I think this is because of
  flutter/flutter#136779
.
@gnprice
Copy link
Member

gnprice commented Jun 15, 2024

Thanks! Looks good — merging.

If we want to make further tweaks to the profile screen (like increasing the label's width further, or reducing their font weight), that'll be easy to do as a followup.

@gnprice gnprice force-pushed the pr-weight-variable-text-style-last-conversions branch from ea62232 to 3b96ee8 Compare June 15, 2024 04:29
@gnprice gnprice merged commit 3b96ee8 into zulip:main Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration review Added by maintainers when PR may be ready for integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants