From 473744df2c50bb2756eed70d451be0262a2dfa74 Mon Sep 17 00:00:00 2001 From: Mehmet Fidanboylu Date: Tue, 18 Aug 2020 08:07:14 -0700 Subject: [PATCH] Revert "fix wrap intrinsic height calculation (#63420)" (#64046) This reverts commit 72619b86421bfdbf4ef7b98cb893b168b89c8677. --- packages/flutter/lib/src/rendering/wrap.dart | 6 +-- .../flutter/test/rendering/wrap_test.dart | 48 ------------------- 2 files changed, 2 insertions(+), 52 deletions(-) diff --git a/packages/flutter/lib/src/rendering/wrap.dart b/packages/flutter/lib/src/rendering/wrap.dart index 60cd5290a6d..64ab12956b1 100644 --- a/packages/flutter/lib/src/rendering/wrap.dart +++ b/packages/flutter/lib/src/rendering/wrap.dart @@ -409,8 +409,7 @@ class RenderWrap extends RenderBox int childCount = 0; RenderBox child = firstChild; while (child != null) { - // We want to make sure its width can only grow as big as the input width. - final double childWidth = math.min(child.getMaxIntrinsicWidth(double.infinity), width); + final double childWidth = child.getMaxIntrinsicWidth(double.infinity); final double childHeight = child.getMaxIntrinsicHeight(childWidth); // There must be at least one child before we move on to the next run. if (childCount > 0 && runWidth + childWidth + spacing > width) { @@ -438,8 +437,7 @@ class RenderWrap extends RenderBox int childCount = 0; RenderBox child = firstChild; while (child != null) { - // We want to make sure its height can only grow as big as the input height. - final double childHeight = math.min(child.getMaxIntrinsicHeight(double.infinity), height); + final double childHeight = child.getMaxIntrinsicHeight(double.infinity); final double childWidth = child.getMaxIntrinsicWidth(childHeight); // There must be at least one child before we move on to the next run. if (childCount > 0 && runHeight + childHeight + spacing > height) { diff --git a/packages/flutter/test/rendering/wrap_test.dart b/packages/flutter/test/rendering/wrap_test.dart index 099b4b9e39c..7ac80e6b253 100644 --- a/packages/flutter/test/rendering/wrap_test.dart +++ b/packages/flutter/test/rendering/wrap_test.dart @@ -70,54 +70,6 @@ void main() { expect(renderWrap.computeMinIntrinsicHeight(79), 250); }); - test('Compute intrinsic height test for width-in-height-out children', () { - const double lineHeight = 15.0; - final RenderWrap renderWrap = RenderWrap(); - renderWrap.add( - RenderParagraph( - const TextSpan( - text: 'A very very very very very very very very long text', - style: TextStyle(fontSize: lineHeight), - ), - textDirection: TextDirection.ltr, - ), - ); - - renderWrap.spacing = 0; - renderWrap.runSpacing = 0; - renderWrap.direction = Axis.horizontal; - - expect(renderWrap.computeMaxIntrinsicHeight(double.infinity), lineHeight); - expect(renderWrap.computeMaxIntrinsicHeight(600), 2 * lineHeight); - expect(renderWrap.computeMaxIntrinsicHeight(300), 3 * lineHeight); - }); - - test('Compute intrinsic width test for height-in-width-out children', () { - const double lineHeight = 15.0; - final RenderWrap renderWrap = RenderWrap(); - renderWrap.add( - // Rotates a width-in-height-out render object to make it height-in-width-out. - RenderRotatedBox( - quarterTurns: 1, - child: RenderParagraph( - const TextSpan( - text: 'A very very very very very very very very long text', - style: TextStyle(fontSize: lineHeight), - ), - textDirection: TextDirection.ltr, - ) - ), - ); - - renderWrap.spacing = 0; - renderWrap.runSpacing = 0; - renderWrap.direction = Axis.vertical; - - expect(renderWrap.computeMaxIntrinsicWidth(double.infinity), lineHeight); - expect(renderWrap.computeMaxIntrinsicWidth(600), 2 * lineHeight); - expect(renderWrap.computeMaxIntrinsicWidth(300), 3 * lineHeight); - }); - test('Compute intrinsic width test', () { final List children = [ RenderConstrainedBox(