5
5
// @dart = 2.10
6
6
part of engine;
7
7
8
+ const ui.Color _defaultTextColor = ui.Color (0xFFFF0000 );
9
+
8
10
class EngineLineMetrics implements ui.LineMetrics {
9
11
EngineLineMetrics ({
10
12
required this .hardBreak,
@@ -1110,15 +1112,15 @@ class EngineParagraphBuilder implements ui.ParagraphBuilder {
1110
1112
/// paragraph. Plain text is more efficient to lay out and measure than rich
1111
1113
/// text.
1112
1114
EngineParagraph ? _tryBuildPlainText () {
1113
- ui.Color ? color;
1115
+ ui.Color color = _defaultTextColor ;
1114
1116
ui.TextDecoration ? decoration;
1115
1117
ui.Color ? decorationColor;
1116
1118
ui.TextDecorationStyle ? decorationStyle;
1117
1119
ui.FontWeight ? fontWeight = _paragraphStyle._fontWeight;
1118
1120
ui.FontStyle ? fontStyle = _paragraphStyle._fontStyle;
1119
1121
ui.TextBaseline ? textBaseline;
1120
- String ? fontFamily = _paragraphStyle._fontFamily;
1121
- double ? fontSize = _paragraphStyle._fontSize;
1122
+ String fontFamily = _paragraphStyle._fontFamily ?? DomRenderer .defaultFontFamily ;
1123
+ double fontSize = _paragraphStyle._fontSize ?? DomRenderer .defaultFontSize ;
1122
1124
final ui.TextAlign textAlign = _paragraphStyle._effectiveTextAlign;
1123
1125
final ui.TextDirection textDirection = _paragraphStyle._effectiveTextDirection;
1124
1126
double ? letterSpacing;
@@ -1138,7 +1140,7 @@ class EngineParagraphBuilder implements ui.ParagraphBuilder {
1138
1140
while (i < _ops.length && _ops[i] is EngineTextStyle ) {
1139
1141
final EngineTextStyle style = _ops[i];
1140
1142
if (style._color != null ) {
1141
- color = style._color;
1143
+ color = style._color! ;
1142
1144
}
1143
1145
if (style._decoration != null ) {
1144
1146
decoration = style._decoration;
@@ -1160,7 +1162,7 @@ class EngineParagraphBuilder implements ui.ParagraphBuilder {
1160
1162
}
1161
1163
fontFamily = style._fontFamily;
1162
1164
if (style._fontSize != null ) {
1163
- fontSize = style._fontSize;
1165
+ fontSize = style._fontSize! ;
1164
1166
}
1165
1167
if (style._letterSpacing != null ) {
1166
1168
letterSpacing = style._letterSpacing;
@@ -1210,9 +1212,7 @@ class EngineParagraphBuilder implements ui.ParagraphBuilder {
1210
1212
paint = foreground;
1211
1213
} else {
1212
1214
paint = ui.Paint ();
1213
- if (color != null ) {
1214
- paint.color = color;
1215
- }
1215
+ paint.color = color;
1216
1216
}
1217
1217
1218
1218
if (i >= _ops.length) {
0 commit comments