Skip to content

Commit 5f0fd0c

Browse files
committed
content: Format **bold text** using weightVariableTextStyle
Fixes: zulip#499
1 parent 2ae5530 commit 5f0fd0c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/widgets/content.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ class InlineContent extends StatelessWidget {
455455

456456
@override
457457
Widget build(BuildContext context) {
458-
return Text.rich(_builder.build());
458+
return Text.rich(_builder.build(context));
459459
}
460460
}
461461

@@ -464,15 +464,20 @@ class _InlineContentBuilder {
464464

465465
final InlineContent widget;
466466

467-
InlineSpan build() {
467+
InlineSpan build(BuildContext context) {
468+
_context = context;
468469
assert(_recognizer == widget.recognizer);
469470
assert(_recognizerStack == null || _recognizerStack!.isEmpty);
470471
final result = _buildNodes(widget.nodes, style: widget.style);
472+
assert(identical(_context, context));
473+
_context = null;
471474
assert(_recognizer == widget.recognizer);
472475
assert(_recognizerStack == null || _recognizerStack!.isEmpty);
473476
return result;
474477
}
475478

479+
BuildContext? _context;
480+
476481
// Why do we have to track `recognizer` here, rather than apply it
477482
// once at the top of the affected span? Because the events don't bubble
478483
// within a paragraph:
@@ -532,7 +537,7 @@ class _InlineContentBuilder {
532537
}
533538

534539
InlineSpan _buildStrong(StrongNode node) => _buildNodes(node.nodes,
535-
style: const TextStyle(fontWeight: FontWeight.w600));
540+
style: weightVariableTextStyle(_context, wght: 600, wghtIfPlatformRequestsBold: 900));
536541

537542
InlineSpan _buildEmphasis(EmphasisNode node) => _buildNodes(node.nodes,
538543
style: const TextStyle(fontStyle: FontStyle.italic));

0 commit comments

Comments
 (0)