Skip to content

Commit 127f420

Browse files
committed
text [nfc]: Pull out kDefaultFontFamily constant
1 parent 01e4f14 commit 127f420

File tree

8 files changed

+21
-15
lines changed

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
@@ -99,7 +99,7 @@ class Paragraph extends StatelessWidget {
9999
final ParagraphNode node;
100100

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

lib/widgets/emoji_reaction.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class ReactionChip extends StatelessWidget {
174174
textWidthBasis: TextWidthBasis.longestLine,
175175
textScaler: _labelTextScalerClamped(context),
176176
style: TextStyle(
177-
fontFamily: 'Source Sans 3',
177+
fontFamily: kDefaultFontFamily,
178178
fontSize: (14 * 0.90),
179179
height: 13 / (14 * 0.90),
180180
color: labelColor,
@@ -352,7 +352,7 @@ class _TextEmoji extends StatelessWidget {
352352
textAlign: TextAlign.end,
353353
textScaler: _textEmojiScalerClamped(context),
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
@@ -240,7 +240,7 @@ abstract class _HeaderItem extends StatelessWidget {
240240
padding: const EdgeInsets.symmetric(vertical: 4),
241241
child: Text(
242242
style: const TextStyle(
243-
fontFamily: 'Source Sans 3',
243+
fontFamily: kDefaultFontFamily,
244244
fontSize: 17,
245245
height: (20 / 17),
246246
color: Color(0xFF222222),
@@ -361,7 +361,7 @@ class _DmItem extends StatelessWidget {
361361
padding: const EdgeInsets.symmetric(vertical: 4),
362362
child: Text(
363363
style: const TextStyle(
364-
fontFamily: 'Source Sans 3',
364+
fontFamily: kDefaultFontFamily,
365365
fontSize: 17,
366366
height: (20 / 17),
367367
color: Color(0xFF222222),
@@ -487,7 +487,7 @@ class _TopicItem extends StatelessWidget {
487487
padding: const EdgeInsets.symmetric(vertical: 4),
488488
child: Text(
489489
style: const TextStyle(
490-
fontFamily: 'Source Sans 3',
490+
fontFamily: kDefaultFontFamily,
491491
fontSize: 17,
492492
height: (20 / 17),
493493
color: Color(0xFF222222),

lib/widgets/message_list.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ class MarkAsReadWidget extends StatelessWidget {
436436
backgroundColor: _UnreadMarker.color,
437437
minimumSize: const Size.fromHeight(38),
438438
textStyle: const TextStyle(
439-
fontFamily: 'Source Sans 3',
439+
fontFamily: kDefaultFontFamily,
440440
fontSize: 18,
441441
height: (23 / 18),
442442
).merge(weightVariableTextStyle(context)),
@@ -573,7 +573,7 @@ class StreamMessageRecipientHeader extends StatelessWidget {
573573
}
574574
final textStyle = TextStyle(
575575
color: contrastingColor,
576-
fontFamily: 'Source Sans 3',
576+
fontFamily: kDefaultFontFamily,
577577
fontSize: 16,
578578
letterSpacing: 0.02 * 16,
579579
height: (18 / 16),
@@ -684,7 +684,7 @@ class DmRecipientHeader extends StatelessWidget {
684684
Expanded(
685685
child: Text(title,
686686
style: const TextStyle(
687-
fontFamily: 'Source Sans 3',
687+
fontFamily: kDefaultFontFamily,
688688
fontSize: 16,
689689
letterSpacing: 0.02 * 16,
690690
height: (18 / 16),
@@ -716,7 +716,7 @@ class RecipientHeaderDate extends StatelessWidget {
716716
child: Text(
717717
style: TextStyle(
718718
color: color,
719-
fontFamily: 'Source Sans 3',
719+
fontFamily: kDefaultFontFamily,
720720
fontSize: 16,
721721
// In Figma this has a line-height of 19, but using 18
722722
// here to match the stream/topic text widgets helps

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),
@@ -220,7 +220,7 @@ class SubscriptionItem extends StatelessWidget {
220220
// https://github.com/zulip/zulip-flutter/pull/397#pullrequestreview-1742524205
221221
child: Text(
222222
style: const TextStyle(
223-
fontFamily: 'Source Sans 3',
223+
fontFamily: kDefaultFontFamily,
224224
fontSize: 18,
225225
height: (20 / 18),
226226
color: Color(0xFF262626),

lib/widgets/text.dart

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

5+
/// The [TextStyle.fontFamily] to use in most of the app.
6+
///
7+
/// This is a variable-weight font, so any [TextStyle] that uses this should be
8+
/// merged with the result of calling [weightVariableTextStyle].
9+
const kDefaultFontFamily = 'Source Sans 3';
10+
511
/// A mergeable [TextStyle] with 'Source Code Pro' and platform-aware fallbacks.
612
///
713
/// 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
@@ -45,7 +45,7 @@ class UnreadCountBadge extends StatelessWidget {
4545
padding: const EdgeInsets.fromLTRB(4, 0, 4, 1),
4646
child: Text(
4747
style: const TextStyle(
48-
fontFamily: 'Source Sans 3',
48+
fontFamily: kDefaultFontFamily,
4949
fontSize: 16,
5050
height: (18 / 16),
5151
fontFeatures: [FontFeature.enable('smcp')], // small caps

0 commit comments

Comments
 (0)