Fix text scaling of strut style (#33462)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user