Skip to content

Commit

Permalink
content: Stop accidentally dropping paragraph text style in user ment…
Browse files Browse the repository at this point in the history
…ions

In c7be9c3 we specified some text style properties to follow web
(including using the Source Sans 3 font). That didn't get applied to
user mentions, so those were conspicuously different from
surrounding text. Fixed now.

Fixes: zulip#430
  • Loading branch information
chrisbobbe authored and gnprice committed Dec 1, 2023
1 parent 8f43bc6 commit ae2f3c9
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/widgets/content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ class Paragraph extends StatelessWidget {

final ParagraphNode node;

static TextStyle getTextStyle(BuildContext context) => const TextStyle(
fontFamily: 'Source Sans 3',
fontSize: 14,
height: (17 / 14),
).merge(weightVariableTextStyle(context));

@override
Widget build(BuildContext context) {
// Empty paragraph winds up with zero height.
Expand All @@ -106,11 +112,7 @@ class Paragraph extends StatelessWidget {

final text = _buildBlockInlineContainer(
node: node,
style: const TextStyle(
fontFamily: 'Source Sans 3',
fontSize: 14,
height: (17 / 14),
).merge(weightVariableTextStyle(context)),
style: getTextStyle(context),
);

// If the paragraph didn't actually have a `p` element in the HTML,
Expand Down Expand Up @@ -594,7 +596,7 @@ class UserMention extends StatelessWidget {
// One hopes an @-mention can't contain an embedded link.
// (The parser on creating a UserMentionNode has a TODO to check that.)
linkRecognizers: null,
style: null,
style: Paragraph.getTextStyle(context),
nodes: node.nodes));
}

Expand Down

0 comments on commit ae2f3c9

Please sign in to comment.