1
1
import 'package:flutter/material.dart' ;
2
2
3
3
import '../model/code_block.dart' ;
4
+ import 'content.dart' ;
4
5
import 'text.dart' ;
5
6
6
7
/// [TextStyle] s used to render code blocks.
@@ -11,6 +12,11 @@ class CodeBlockTextStyles {
11
12
factory CodeBlockTextStyles (BuildContext context) {
12
13
final bold = weightVariableTextStyle (context, wght: 700 );
13
14
return CodeBlockTextStyles ._(
15
+ plain: kMonospaceTextStyle
16
+ .merge (const TextStyle (
17
+ fontSize: 0.825 * kBaseFontSize,
18
+ height: 1.4 )),
19
+
14
20
// .hll { background-color: hsl(60deg 100% 90%); }
15
21
hll: TextStyle (backgroundColor: const HSLColor .fromAHSL (1 , 60 , 1 , 0.90 ).toColor ()),
16
22
@@ -204,6 +210,7 @@ class CodeBlockTextStyles {
204
210
}
205
211
206
212
CodeBlockTextStyles ._({
213
+ required this .plain,
207
214
required TextStyle hll,
208
215
required TextStyle c,
209
216
required TextStyle err,
@@ -330,6 +337,9 @@ class CodeBlockTextStyles {
330
337
_vi = vi,
331
338
_il = il;
332
339
340
+ /// The baseline style that the [forSpan] styles get applied on top of.
341
+ final TextStyle plain;
342
+
333
343
final TextStyle _hll;
334
344
final TextStyle _c;
335
345
final TextStyle _err;
@@ -471,6 +481,7 @@ class CodeBlockTextStyles {
471
481
if (identical (this , other)) return this ;
472
482
473
483
return CodeBlockTextStyles ._(
484
+ plain: TextStyle .lerp (plain, other? .plain, t)! ,
474
485
hll: TextStyle .lerp (_hll, other? ._hll, t)! ,
475
486
c: TextStyle .lerp (_c, other? ._c, t)! ,
476
487
err: TextStyle .lerp (_err, other? ._err, t)! ,
0 commit comments