@@ -894,7 +894,38 @@ class EngineParagraphStyle implements ui.ParagraphStyle {
894894
895895/// The web implementation of [ui.TextStyle] .
896896class EngineTextStyle implements ui.TextStyle {
897- EngineTextStyle ({
897+ /// Constructs an [EngineTextStyle] with all properties being required.
898+ ///
899+ /// This is good for call sites that need to be updated whenever a new
900+ /// property is added to [EngineTextStyle] . Non-updated call sites will fail
901+ /// the build otherwise.
902+ factory EngineTextStyle ({
903+ required ui.Color ? color,
904+ required ui.TextDecoration ? decoration,
905+ required ui.Color ? decorationColor,
906+ required ui.TextDecorationStyle ? decorationStyle,
907+ required double ? decorationThickness,
908+ required ui.FontWeight ? fontWeight,
909+ required ui.FontStyle ? fontStyle,
910+ required ui.TextBaseline ? textBaseline,
911+ required String ? fontFamily,
912+ required List <String >? fontFamilyFallback,
913+ required double ? fontSize,
914+ required double ? letterSpacing,
915+ required double ? wordSpacing,
916+ required double ? height,
917+ required ui.Locale ? locale,
918+ required ui.Paint ? background,
919+ required ui.Paint ? foreground,
920+ required List <ui.Shadow >? shadows,
921+ required List <ui.FontFeature >? fontFeatures,
922+ }) = EngineTextStyle .only;
923+
924+ /// Constructs an [EngineTextStyle] with only the given properties.
925+ ///
926+ /// This constructor should be used sparingly in tests, for example. Or when
927+ /// we know for sure that not all properties are needed.
928+ EngineTextStyle .only ({
898929 ui.Color ? color,
899930 ui.TextDecoration ? decoration,
900931 ui.Color ? decorationColor,
@@ -940,14 +971,20 @@ class EngineTextStyle implements ui.TextStyle {
940971 _foreground = foreground,
941972 _shadows = shadows;
942973
943- factory EngineTextStyle .fromParagraphStyle (EngineParagraphStyle paragraphStyle) => EngineTextStyle (
944- fontWeight: paragraphStyle._fontWeight,
945- fontStyle: paragraphStyle._fontStyle,
946- fontFamily: paragraphStyle._fontFamily,
947- fontSize: paragraphStyle._fontSize,
948- height: paragraphStyle._height,
949- locale: paragraphStyle._locale,
950- );
974+ /// Constructs an [EngineTextStyle] by reading properties from an
975+ /// [EngineParagraphStyle] .
976+ factory EngineTextStyle .fromParagraphStyle (
977+ EngineParagraphStyle paragraphStyle,
978+ ) {
979+ return EngineTextStyle .only (
980+ fontWeight: paragraphStyle._fontWeight,
981+ fontStyle: paragraphStyle._fontStyle,
982+ fontFamily: paragraphStyle._fontFamily,
983+ fontSize: paragraphStyle._fontSize,
984+ height: paragraphStyle._height,
985+ locale: paragraphStyle._locale,
986+ );
987+ }
951988
952989 final ui.Color ? _color;
953990 final ui.TextDecoration ? _decoration;
@@ -1281,10 +1318,13 @@ class DomParagraphBuilder implements ui.ParagraphBuilder {
12811318 ui.TextDecoration ? decoration;
12821319 ui.Color ? decorationColor;
12831320 ui.TextDecorationStyle ? decorationStyle;
1321+ double ? decorationThickness;
12841322 ui.FontWeight ? fontWeight = _paragraphStyle._fontWeight;
12851323 ui.FontStyle ? fontStyle = _paragraphStyle._fontStyle;
12861324 ui.TextBaseline ? textBaseline;
12871325 String fontFamily = _paragraphStyle._fontFamily ?? DomRenderer .defaultFontFamily;
1326+ List <String >? fontFamilyFallback;
1327+ List <ui.FontFeature >? fontFeatures;
12881328 double fontSize = _paragraphStyle._fontSize ?? DomRenderer .defaultFontSize;
12891329 final ui.TextAlign textAlign = _paragraphStyle._effectiveTextAlign;
12901330 final ui.TextDirection textDirection = _paragraphStyle._effectiveTextDirection;
@@ -1316,6 +1356,9 @@ class DomParagraphBuilder implements ui.ParagraphBuilder {
13161356 if (style._decorationStyle != null ) {
13171357 decorationStyle = style._decorationStyle;
13181358 }
1359+ if (style._decorationThickness != null ) {
1360+ decorationThickness = style._decorationThickness;
1361+ }
13191362 if (style._fontWeight != null ) {
13201363 fontWeight = style._fontWeight;
13211364 }
@@ -1326,6 +1369,12 @@ class DomParagraphBuilder implements ui.ParagraphBuilder {
13261369 textBaseline = style._textBaseline;
13271370 }
13281371 fontFamily = style._fontFamily;
1372+ if (style._fontFamilyFallback != null ) {
1373+ fontFamilyFallback = style._fontFamilyFallback;
1374+ }
1375+ if (style._fontFeatures != null ) {
1376+ fontFeatures = style._fontFeatures;
1377+ }
13291378 if (style._fontSize != null ) {
13301379 fontSize = style._fontSize! ;
13311380 }
@@ -1358,10 +1407,13 @@ class DomParagraphBuilder implements ui.ParagraphBuilder {
13581407 decoration: decoration,
13591408 decorationColor: decorationColor,
13601409 decorationStyle: decorationStyle,
1410+ decorationThickness: decorationThickness,
13611411 fontWeight: fontWeight,
13621412 fontStyle: fontStyle,
13631413 textBaseline: textBaseline,
13641414 fontFamily: fontFamily,
1415+ fontFamilyFallback: fontFamilyFallback,
1416+ fontFeatures: fontFeatures,
13651417 fontSize: fontSize,
13661418 letterSpacing: letterSpacing,
13671419 wordSpacing: wordSpacing,
0 commit comments