Skip to content

Commit 06f03d1

Browse files
chunhtaimingwandroid
authored andcommitted
Reland "remove usage to applyTextScaleFactorToWidgetSpan" (flutter#62587)
This reverts commit 561735a.
1 parent 4c12f03 commit 06f03d1

File tree

4 files changed

+1
-23
lines changed

4 files changed

+1
-23
lines changed

packages/flutter/lib/src/rendering/paragraph.dart

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,6 @@ class RenderParagraph extends RenderBox
7979
StrutStyle strutStyle,
8080
TextWidthBasis textWidthBasis = TextWidthBasis.parent,
8181
ui.TextHeightBehavior textHeightBehavior,
82-
@Deprecated(
83-
'This parameter is a temporary flag to migrate the internal tests and '
84-
'should not be used in other contexts. For more details, please check '
85-
'https://github.com/flutter/flutter/issues/59316. '
86-
'This feature was deprecated after v1.19.0.'
87-
)
88-
bool applyTextScaleFactorToWidgetSpan = false,
8982
List<RenderBox> children,
9083
}) : assert(text != null),
9184
assert(text.debugAssertIsValid()),
@@ -98,7 +91,6 @@ class RenderParagraph extends RenderBox
9891
assert(textWidthBasis != null),
9992
_softWrap = softWrap,
10093
_overflow = overflow,
101-
_applyTextScaleFactorToWidgetSpan = applyTextScaleFactorToWidgetSpan,
10294
_textPainter = TextPainter(
10395
text: text,
10496
textAlign: textAlign,
@@ -298,8 +290,6 @@ class RenderParagraph extends RenderBox
298290
markNeedsLayout();
299291
}
300292

301-
final bool _applyTextScaleFactorToWidgetSpan;
302-
303293
@override
304294
double computeMinIntrinsicWidth(double height) {
305295
if (!_canComputeIntrinsics()) {
@@ -540,8 +530,7 @@ class RenderParagraph extends RenderBox
540530
// The content will be enlarged by textScaleFactor during painting phase.
541531
// We reduce constraint by textScaleFactor so that the content will fit
542532
// into the box once it is enlarged.
543-
if (_applyTextScaleFactorToWidgetSpan)
544-
boxConstraints = boxConstraints / textScaleFactor;
533+
boxConstraints = boxConstraints / textScaleFactor;
545534
while (child != null) {
546535
// Only constrain the width to the maximum width of the paragraph.
547536
// Leave height unconstrained, which will overflow if expanded past.

packages/flutter/lib/src/widgets/basic.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5201,7 +5201,6 @@ class RichText extends MultiChildRenderObjectWidget {
52015201
assert(textScaleFactor != null),
52025202
assert(maxLines == null || maxLines > 0),
52035203
assert(textWidthBasis != null),
5204-
_applyTextScaleFactorToWidgetSpan = applyTextScaleFactorToWidgetSpan,
52055204
super(key: key, children: _extractChildren(text));
52065205

52075206
// Traverses the InlineSpan tree and depth-first collects the list of
@@ -5279,8 +5278,6 @@ class RichText extends MultiChildRenderObjectWidget {
52795278
/// {@macro flutter.dart:ui.textHeightBehavior}
52805279
final ui.TextHeightBehavior textHeightBehavior;
52815280

5282-
final bool _applyTextScaleFactorToWidgetSpan;
5283-
52845281
@override
52855282
RenderParagraph createRenderObject(BuildContext context) {
52865283
assert(textDirection != null || debugCheckHasDirectionality(context));
@@ -5294,7 +5291,6 @@ class RichText extends MultiChildRenderObjectWidget {
52945291
strutStyle: strutStyle,
52955292
textWidthBasis: textWidthBasis,
52965293
textHeightBehavior: textHeightBehavior,
5297-
applyTextScaleFactorToWidgetSpan: _applyTextScaleFactorToWidgetSpan,
52985294
locale: locale ?? Localizations.localeOf(context, nullOk: true),
52995295
);
53005296
}

packages/flutter/lib/src/widgets/text.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,6 @@ class Text extends StatelessWidget {
361361
'A non-null String must be provided to a Text widget.',
362362
),
363363
textSpan = null,
364-
_applyTextScaleFactorToWidgetSpan = true,
365364
super(key: key);
366365

367366
/// Creates a text widget with a [InlineSpan].
@@ -401,7 +400,6 @@ class Text extends StatelessWidget {
401400
'A non-null TextSpan must be provided to a Text.rich widget.',
402401
),
403402
data = null,
404-
_applyTextScaleFactorToWidgetSpan = applyTextScaleFactorToWidgetSpan,
405403
super(key: key);
406404

407405
/// The text to display.
@@ -504,8 +502,6 @@ class Text extends StatelessWidget {
504502
/// {@macro flutter.dart:ui.textHeightBehavior}
505503
final ui.TextHeightBehavior textHeightBehavior;
506504

507-
final bool _applyTextScaleFactorToWidgetSpan;
508-
509505
@override
510506
Widget build(BuildContext context) {
511507
final DefaultTextStyle defaultTextStyle = DefaultTextStyle.of(context);
@@ -525,7 +521,6 @@ class Text extends StatelessWidget {
525521
strutStyle: strutStyle,
526522
textWidthBasis: textWidthBasis ?? defaultTextStyle.textWidthBasis,
527523
textHeightBehavior: textHeightBehavior ?? defaultTextStyle.textHeightBehavior ?? DefaultTextHeightBehavior.of(context),
528-
applyTextScaleFactorToWidgetSpan: _applyTextScaleFactorToWidgetSpan,
529524
text: TextSpan(
530525
style: effectiveTextStyle,
531526
text: data,

packages/flutter/test/widgets/text_test.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ void main() {
186186
key: key,
187187
textDirection: TextDirection.ltr,
188188
textScaleFactor: textScaleFactor,
189-
applyTextScaleFactorToWidgetSpan: true,
190189
),
191190
),
192191
),
@@ -215,7 +214,6 @@ void main() {
215214
key: key,
216215
textDirection: TextDirection.ltr,
217216
textScaleFactor: textScaleFactor,
218-
applyTextScaleFactorToWidgetSpan: true,
219217
),
220218
),
221219
),

0 commit comments

Comments
 (0)