Fix text scaling of strut style (#33462)
diff --git a/packages/flutter/lib/src/painting/text_style.dart b/packages/flutter/lib/src/painting/text_style.dart
index 285d2db..e36edcf 100644
--- a/packages/flutter/lib/src/painting/text_style.dart
+++ b/packages/flutter/lib/src/painting/text_style.dart
@@ -959,7 +959,7 @@
strutStyle: strutStyle == null ? null : ui.StrutStyle(
fontFamily: strutStyle.fontFamily,
fontFamilyFallback: strutStyle.fontFamilyFallback,
- fontSize: strutStyle.fontSize,
+ fontSize: strutStyle.fontSize == null ? null : strutStyle.fontSize * textScaleFactor,
height: strutStyle.height,
leading: strutStyle.leading,
fontWeight: strutStyle.fontWeight,
diff --git a/packages/flutter/test/painting/text_style_test.dart b/packages/flutter/test/painting/text_style_test.dart
index 233ec86..c88f6fd 100644
--- a/packages/flutter/test/painting/text_style_test.dart
+++ b/packages/flutter/test/painting/text_style_test.dart
@@ -354,4 +354,14 @@
expect(TextStyle.lerp(redPaintTextStyle, bluePaintTextStyle, .25).background.color, red);
expect(TextStyle.lerp(redPaintTextStyle, bluePaintTextStyle, .75).background.color, blue);
});
+
+ test('TextStyle strut textScaleFactor', () {
+ const TextStyle style0 = TextStyle(fontSize: 10);
+ final ui.ParagraphStyle paragraphStyle0 = style0.getParagraphStyle(textScaleFactor: 2.5);
+
+ const TextStyle style1 = TextStyle(fontSize: 25);
+ final ui.ParagraphStyle paragraphStyle1 = style1.getParagraphStyle(textScaleFactor: 1);
+
+ expect(paragraphStyle0 == paragraphStyle1, true);
+ });
}