From 501b948e05b1826dc640174cd34f0c8e5de8ed74 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Tue, 8 Mar 2016 11:14:00 -0800 Subject: [PATCH] Remove bogus intrinsic size assert This patch tweaks the definition of max intrinsic size to give implementations more wiggle room to compute there intrinsic sizes more efficiently. Specifically, implementations can now ignore the incomming constraint in the cross axis if they prefer. This patch removes an assert that is no longer valid w.r.t. the new definition of intrinsic sizing. Fixes #2099 --- packages/flutter/lib/src/rendering/block.dart | 5 ----- packages/flutter/lib/src/rendering/box.dart | 4 ++-- packages/flutter/lib/src/rendering/grid.dart | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/flutter/lib/src/rendering/block.dart b/packages/flutter/lib/src/rendering/block.dart index 742a94bd45..f3b2d85c4b 100644 --- a/packages/flutter/lib/src/rendering/block.dart +++ b/packages/flutter/lib/src/rendering/block.dart @@ -151,11 +151,6 @@ class RenderBlock extends RenderBlockBase { double childExtent = isVertical ? child.getMinIntrinsicHeight(innerConstraints) : child.getMinIntrinsicWidth(innerConstraints); - assert(() { - if (isVertical) - return childExtent == child.getMaxIntrinsicHeight(innerConstraints); - return childExtent == child.getMaxIntrinsicWidth(innerConstraints); - }); extent += childExtent; final BlockParentData childParentData = child.parentData; child = childParentData.nextSibling; diff --git a/packages/flutter/lib/src/rendering/box.dart b/packages/flutter/lib/src/rendering/box.dart index 8376623729..c97da57dbc 100644 --- a/packages/flutter/lib/src/rendering/box.dart +++ b/packages/flutter/lib/src/rendering/box.dart @@ -419,7 +419,7 @@ abstract class RenderBox extends RenderObject { } /// Returns the smallest width beyond which increasing the width never - /// decreases the height. + /// decreases the preferred height. /// /// Override in subclasses that implement [performLayout]. double getMaxIntrinsicWidth(BoxConstraints constraints) { @@ -437,7 +437,7 @@ abstract class RenderBox extends RenderObject { } /// Returns the smallest height beyond which increasing the height never - /// decreases the width. + /// decreases the preferred width. /// /// If the layout algorithm used is width-in-height-out, i.e. the height /// depends on the width and not vice versa, then this will return the same diff --git a/packages/flutter/lib/src/rendering/grid.dart b/packages/flutter/lib/src/rendering/grid.dart index 7367d80f0a..02059c917d 100644 --- a/packages/flutter/lib/src/rendering/grid.dart +++ b/packages/flutter/lib/src/rendering/grid.dart @@ -166,7 +166,7 @@ abstract class GridDelegate { } /// Returns the smallest width beyond which increasing the width never - /// decreases the height. + /// decreases the preferred height. double getMaxIntrinsicWidth(BoxConstraints constraints, int childCount) { return constraints.constrainWidth(_getGridSize(constraints, childCount).width); } @@ -178,7 +178,7 @@ abstract class GridDelegate { } /// Returns the smallest height beyond which increasing the height never - /// decreases the width. + /// decreases the preferred width. double getMaxIntrinsicHeight(BoxConstraints constraints, int childCount) { return constraints.constrainHeight(_getGridSize(constraints, childCount).height); }