Remove strut migration flag from TextPainter (#144242)

Fixes https://github.com/flutter/flutter/issues/142969.

G3fix: cl/610790040
This commit is contained in:
LongCatIsLooong
2024-02-27 11:13:58 -08:00
committed by GitHub
parent d1d9605974
commit a23c81333f
2 changed files with 30 additions and 27 deletions

View File

@@ -683,12 +683,6 @@ class TextPainter {
}
}
@Deprecated( // flutter_ignore: deprecation_syntax (see analyze.dart)
'The disableStrutHalfLeading flag is for internal migration purposes only and should not be used.'
)
/// Migration only flag, do not use.
static bool disableStrutHalfLeading = true;
// Whether textWidthBasis has changed after the most recent `layout` call.
bool _debugNeedsRelayout = true;
// The result of the most recent `layout` call.
@@ -1024,25 +1018,6 @@ class TextPainter {
ui.ParagraphStyle _createParagraphStyle([ TextAlign? textAlignOverride ]) {
assert(textDirection != null, 'TextPainter.textDirection must be set to a non-null value before using the TextPainter.');
final TextStyle baseStyle = _text?.style ?? const TextStyle();
final StrutStyle? strutStyle = _strutStyle;
final bool applyMigration = !kIsWeb && TextPainter.disableStrutHalfLeading
&& strutStyle != null && (strutStyle.forceStrutHeight ?? false)
&& strutStyle.leadingDistribution == TextLeadingDistribution.even;
final StrutStyle? strutStyleForMigration = !applyMigration
? strutStyle
: StrutStyle(
fontFamily: strutStyle.fontFamily,
fontFamilyFallback: strutStyle.fontFamilyFallback,
fontSize: strutStyle.fontSize,
height: strutStyle.height,
leadingDistribution: TextLeadingDistribution.proportional,
leading: strutStyle.leading,
fontWeight: strutStyle.fontWeight,
fontStyle: strutStyle.fontStyle,
forceStrutHeight: strutStyle.forceStrutHeight,
);
return baseStyle.getParagraphStyle(
textAlign: textAlignOverride ?? textAlign,
textDirection: textDirection,
@@ -1051,7 +1026,7 @@ class TextPainter {
textHeightBehavior: _textHeightBehavior,
ellipsis: _ellipsis,
locale: _locale,
strutStyle: strutStyleForMigration,
strutStyle: _strutStyle,
);
}