Fix text scaling of strut style (#33462)

This commit is contained in:
Gary Qian
2019-05-30 10:13:17 -07:00
committed by GitHub
parent fa3fbc89a3
commit 2cb5b24b02
2 changed files with 11 additions and 1 deletions

View File

@@ -959,7 +959,7 @@ class TextStyle extends Diagnosticable {
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,

View File

@@ -354,4 +354,14 @@ void main() {
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);
});
}