Skip to content

Commit 0065954

Browse files
chrisbobbegnprice
authored andcommitted
text: Set 0 letter spacing throughout zulipTypography
This zeroes out the letter spacing in message content (#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 #545 and #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 #548: letter spacing of 1% (i.e., 0.01 times `fontSize`) in buttons. Fixes: #545 Fixes-partly: #548
1 parent 910fe5c commit 0065954

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

lib/widgets/text.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ Typography zulipTypography(BuildContext context) {
3636

3737
convertGeometry(TextTheme inputTextTheme) {
3838
TextTheme result = _weightVariableTextTheme(context, inputTextTheme);
39+
40+
result = _convertTextTheme(result, (maybeInputStyle, _) =>
41+
maybeInputStyle?.merge(const TextStyle(letterSpacing: 0)));
42+
3943
return result;
4044
}
4145

test/flutter_checks.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ extension TextFieldChecks on Subject<TextField> {
5959
extension TextStyleChecks on Subject<TextStyle> {
6060
Subject<bool> get inherit => has((t) => t.inherit, 'inherit');
6161
Subject<FontWeight?> get fontWeight => has((t) => t.fontWeight, 'fontWeight');
62+
Subject<double?> get letterSpacing => has((t) => t.letterSpacing, 'letterSpacing');
6263
Subject<List<FontVariation>?> get fontVariations => has((t) => t.fontVariations, 'fontVariations');
6364
Subject<String?> get fontFamily => has((t) => t.fontFamily, 'fontFamily');
6465
Subject<List<String>?> get fontFamilyFallback => has((t) => t.fontFamilyFallback, 'fontFamilyFallback');

test/widgets/text_test.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ void main() {
4747
});
4848
}
4949

50+
testWidgets('zero letter spacing', (tester) async {
51+
check(await getZulipTypography(tester, platformRequestsBold: false))
52+
..englishLike.bodyMedium.isNotNull().letterSpacing.equals(0)
53+
..dense.bodyMedium.isNotNull().letterSpacing.equals(0)
54+
..tall.bodyMedium.isNotNull().letterSpacing.equals(0);
55+
});
56+
5057
test('Typography has the assumed fields', () {
5158
check(Typography().toDiagnosticsNode().getProperties().map((n) => n.name).toList())
5259
.unorderedEquals(['black', 'white', 'englishLike', 'dense', 'tall']);

0 commit comments

Comments
 (0)