@@ -97,7 +97,7 @@ class Paragraph extends StatelessWidget {
97
97
// The paragraph has vertical CSS margins, but those have no effect.
98
98
if (node.nodes.isEmpty) return const SizedBox ();
99
99
100
- final text = Text .rich (TextSpan (children : _buildInlineList ( node.nodes) ));
100
+ final text = Text .rich (_buildInlineSpan ( node.nodes, style : null ));
101
101
102
102
// If the paragraph didn't actually have a `p` element in the HTML,
103
103
// then apply no margins. (For example, these are seen in list items.)
@@ -122,9 +122,9 @@ class Heading extends StatelessWidget {
122
122
assert (node.level == HeadingLevel .h6);
123
123
return Padding (
124
124
padding: const EdgeInsets .only (top: 15 , bottom: 5 ),
125
- child: Text .rich (TextSpan (
125
+ child: Text .rich (_buildInlineSpan (
126
126
style: const TextStyle (fontWeight: FontWeight .w600, height: 1.4 ),
127
- children : _buildInlineList ( node.nodes) )));
127
+ node.nodes)));
128
128
}
129
129
}
130
130
@@ -297,12 +297,15 @@ class _SingleChildScrollViewWithScrollbarState
297
297
// Inline layout.
298
298
//
299
299
300
- List <InlineSpan > _buildInlineList (List <InlineContentNode > nodes) =>
301
- nodes.map (_buildInlineNode).toList (growable: false );
300
+ InlineSpan _buildInlineSpan (List <InlineContentNode > nodes, {required TextStyle ? style}) {
301
+ return TextSpan (
302
+ style: style,
303
+ children: nodes.map (_buildInlineNode).toList (growable: false ));
304
+ }
302
305
303
306
InlineSpan _buildInlineNode (InlineContentNode node) {
304
307
InlineSpan styled (List <InlineContentNode > nodes, TextStyle style) =>
305
- TextSpan (children : _buildInlineList ( nodes) , style: style);
308
+ _buildInlineSpan ( nodes, style: style);
306
309
307
310
if (node is TextNode ) {
308
311
return TextSpan (text: node.text);
@@ -362,8 +365,7 @@ InlineSpan inlineCode(InlineCodeNode node) {
362
365
// TODO `code`: find equivalent of web's `unicode-bidi: embed; direction: ltr`
363
366
364
367
// Use a light gray background, instead of a border.
365
- return TextSpan (style: _kInlineCodeStyle,
366
- children: _buildInlineList (node.nodes));
368
+ return _buildInlineSpan (style: _kInlineCodeStyle, node.nodes);
367
369
368
370
// Another fun solution -- we can in fact have a border! Like so:
369
371
// TextStyle(
@@ -428,7 +430,7 @@ class UserMention extends StatelessWidget {
428
430
return Container (
429
431
decoration: _kDecoration,
430
432
padding: const EdgeInsets .symmetric (horizontal: 0.2 * kBaseFontSize),
431
- child: Text .rich (TextSpan (children : _buildInlineList ( node.nodes) )));
433
+ child: Text .rich (_buildInlineSpan ( node.nodes, style : null )));
432
434
}
433
435
434
436
static get _kDecoration => BoxDecoration (
0 commit comments