Skip to content

Commit b055d1e

Browse files
committed
text [nfc]: Pull out kDefaultFontFamily constant
1 parent 0de01a4 commit b055d1e

8 files changed

+21
-15
lines changed

lib/widgets/content.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class Paragraph extends StatelessWidget {
101101
final ParagraphNode node;
102102

103103
static TextStyle getTextStyle(BuildContext context) => const TextStyle(
104-
fontFamily: 'Source Sans 3',
104+
fontFamily: kDefaultFontFamily,
105105
fontSize: 14,
106106
height: (17 / 14),
107107
).merge(weightVariableTextStyle(context));

lib/widgets/emoji_reaction.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class ReactionChip extends StatelessWidget {
173173
textWidthBasis: TextWidthBasis.longestLine,
174174
textScaler: _labelTextScalerClamped(context),
175175
style: TextStyle(
176-
fontFamily: 'Source Sans 3',
176+
fontFamily: kDefaultFontFamily,
177177
fontSize: (14 * 0.90),
178178
height: 13 / (14 * 0.90),
179179
color: labelColor,
@@ -352,7 +352,7 @@ class _TextEmoji extends StatelessWidget {
352352
textScaler: _textEmojiScalerClamped(context),
353353
textWidthBasis: TextWidthBasis.longestLine,
354354
style: TextStyle(
355-
fontFamily: 'Source Sans 3',
355+
fontFamily: kDefaultFontFamily,
356356
fontSize: 14 * 0.8,
357357
height: 1, // to be denser when we have to wrap
358358
color: selected ? _textColorSelected : _textColorUnselected,

lib/widgets/inbox.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ abstract class _HeaderItem extends StatelessWidget {
238238
padding: const EdgeInsets.symmetric(vertical: 4),
239239
child: Text(
240240
style: const TextStyle(
241-
fontFamily: 'Source Sans 3',
241+
fontFamily: kDefaultFontFamily,
242242
fontSize: 17,
243243
height: (20 / 17),
244244
color: Color(0xFF222222),
@@ -359,7 +359,7 @@ class _DmItem extends StatelessWidget {
359359
padding: const EdgeInsets.symmetric(vertical: 4),
360360
child: Text(
361361
style: const TextStyle(
362-
fontFamily: 'Source Sans 3',
362+
fontFamily: kDefaultFontFamily,
363363
fontSize: 17,
364364
height: (20 / 17),
365365
color: Color(0xFF222222),
@@ -485,7 +485,7 @@ class _TopicItem extends StatelessWidget {
485485
padding: const EdgeInsets.symmetric(vertical: 4),
486486
child: Text(
487487
style: const TextStyle(
488-
fontFamily: 'Source Sans 3',
488+
fontFamily: kDefaultFontFamily,
489489
fontSize: 17,
490490
height: (20 / 17),
491491
color: Color(0xFF222222),

lib/widgets/message_list.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ class MarkAsReadWidget extends StatelessWidget {
439439
backgroundColor: _UnreadMarker.color,
440440
minimumSize: const Size.fromHeight(38),
441441
textStyle: const TextStyle(
442-
fontFamily: 'Source Sans 3',
442+
fontFamily: kDefaultFontFamily,
443443
fontSize: 18,
444444
height: (23 / 18),
445445
).merge(weightVariableTextStyle(context)),
@@ -620,7 +620,7 @@ class StreamMessageRecipientHeader extends StatelessWidget {
620620
}
621621
final textStyle = TextStyle(
622622
color: contrastingColor,
623-
fontFamily: 'Source Sans 3',
623+
fontFamily: kDefaultFontFamily,
624624
fontSize: 16,
625625
letterSpacing: 0.02 * 16,
626626
height: (18 / 16),
@@ -731,7 +731,7 @@ class DmRecipientHeader extends StatelessWidget {
731731
Expanded(
732732
child: Text(title,
733733
style: const TextStyle(
734-
fontFamily: 'Source Sans 3',
734+
fontFamily: kDefaultFontFamily,
735735
fontSize: 16,
736736
letterSpacing: 0.02 * 16,
737737
height: (18 / 16),
@@ -790,7 +790,7 @@ class DateText extends StatelessWidget {
790790
return Text(
791791
style: TextStyle(
792792
color: color,
793-
fontFamily: 'Source Sans 3',
793+
fontFamily: kDefaultFontFamily,
794794
fontSize: fontSize,
795795
height: height,
796796
// This is equivalent to css `all-small-caps`, see:

lib/widgets/recent_dm_conversations.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class RecentDmConversationsItem extends StatelessWidget {
127127
padding: const EdgeInsets.symmetric(vertical: 4),
128128
child: Text(
129129
style: const TextStyle(
130-
fontFamily: 'Source Sans 3',
130+
fontFamily: kDefaultFontFamily,
131131
fontSize: 17,
132132
height: (20 / 17),
133133
color: Color(0xFF222222),

lib/widgets/subscription_list.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class _NoSubscriptionsItem extends StatelessWidget {
119119
textAlign: TextAlign.center,
120120
style: TextStyle(
121121
color: const HSLColor.fromAHSL(1.0, 240, 0.1, 0.5).toColor(),
122-
fontFamily: 'Source Sans 3',
122+
fontFamily: kDefaultFontFamily,
123123
fontSize: 18,
124124
height: (20 / 18),
125125
).merge(weightVariableTextStyle(context)))));
@@ -148,7 +148,7 @@ class _SubscriptionListHeader extends StatelessWidget {
148148
textAlign: TextAlign.center,
149149
style: TextStyle(
150150
color: const HSLColor.fromAHSL(1.0, 240, 0.1, 0.5).toColor(),
151-
fontFamily: 'Source Sans 3',
151+
fontFamily: kDefaultFontFamily,
152152
fontSize: 14,
153153
letterSpacing: 0.04 * 14,
154154
height: (16 / 14),
@@ -221,7 +221,7 @@ class SubscriptionItem extends StatelessWidget {
221221
// https://github.com/zulip/zulip-flutter/pull/397#pullrequestreview-1742524205
222222
child: Text(
223223
style: const TextStyle(
224-
fontFamily: 'Source Sans 3',
224+
fontFamily: kDefaultFontFamily,
225225
fontSize: 18,
226226
height: (20 / 18),
227227
color: Color(0xFF262626),

lib/widgets/text.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import 'dart:io';
22
import 'package:flutter/widgets.dart';
33

4+
/// The [TextStyle.fontFamily] to use in most of the app.
5+
///
6+
/// This is a variable-weight font, so any [TextStyle] that uses this should be
7+
/// merged with the result of calling [weightVariableTextStyle].
8+
const kDefaultFontFamily = 'Source Sans 3';
9+
410
/// A mergeable [TextStyle] with 'Source Code Pro' and platform-aware fallbacks.
511
///
612
/// Callers should also call [weightVariableTextStyle] and merge that in too,

lib/widgets/unread_count_badge.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class UnreadCountBadge extends StatelessWidget {
4444
padding: const EdgeInsets.fromLTRB(4, 0, 4, 1),
4545
child: Text(
4646
style: const TextStyle(
47-
fontFamily: 'Source Sans 3',
47+
fontFamily: kDefaultFontFamily,
4848
fontSize: 16,
4949
height: (18 / 16),
5050
fontFeatures: [FontFeature.enable('smcp')], // small caps

0 commit comments

Comments
 (0)