Index: sky/sdk/lib/rendering/box.dart |
diff --git a/sky/sdk/lib/rendering/box.dart b/sky/sdk/lib/rendering/box.dart |
index 21d1878ffe30d33de4a9e40f25a8f3cd1707f24e..94c2578a9185ed21050122aee9e81fa750bf9625 100644 |
--- a/sky/sdk/lib/rendering/box.dart |
+++ b/sky/sdk/lib/rendering/box.dart |
@@ -77,7 +77,7 @@ class BoxConstraints extends Constraints { |
minHeight = size.height, |
maxHeight = size.height; |
- BoxConstraints.tightFor({ |
+ const BoxConstraints.tightFor({ |
double width, |
double height |
}): minWidth = width != null ? width : 0.0, |
@@ -91,6 +91,25 @@ class BoxConstraints extends Constraints { |
minHeight = 0.0, |
maxHeight = size.height; |
+ const BoxConstraints.expandWidth({ |
+ this.maxHeight: double.INFINITY |
+ }): minWidth = double.INFINITY, |
+ maxWidth = double.INFINITY, |
+ minHeight = 0.0; |
+ |
+ const BoxConstraints.expandHeight({ |
+ this.maxWidth: double.INFINITY |
+ }): minWidth = 0.0, |
+ minHeight = double.INFINITY, |
+ maxHeight = double.INFINITY; |
+ |
+ static const BoxConstraints expand = const BoxConstraints( |
+ minWidth: double.INFINITY, |
+ maxWidth: double.INFINITY, |
+ minHeight: double.INFINITY, |
+ maxHeight: double.INFINITY |
+ ); |
+ |
BoxConstraints deflate(EdgeDims edges) { |
assert(edges != null); |
double horizontal = edges.left + edges.right; |
@@ -172,11 +191,11 @@ class BoxConstraints extends Constraints { |
final double minHeight; |
final double maxHeight; |
- double constrainWidth(double width) { |
+ double constrainWidth([double width = double.INFINITY]) { |
return clamp(min: minWidth, max: maxWidth, value: width); |
} |
- double constrainHeight(double height) { |
+ double constrainHeight([double height = double.INFINITY]) { |
return clamp(min: minHeight, max: maxHeight, value: height); |
} |
@@ -312,8 +331,7 @@ abstract class RenderBox extends RenderObject { |
void performResize() { |
// default behaviour for subclasses that have sizedByParent = true |
size = constraints.constrain(Size.zero); |
- assert(size.height < double.INFINITY); |
- assert(size.width < double.INFINITY); |
+ assert(!size.isInfinite); |
} |
void performLayout() { |
// descendants have to either override performLayout() to set both |
@@ -1131,8 +1149,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox> |
_orientation = _rootConstraints.orientation; |
} |
_size = new Size(_rootConstraints.width, _rootConstraints.height); |
- assert(_size.height < double.INFINITY); |
- assert(_size.width < double.INFINITY); |
+ assert(!_size.isInfinite); |
if (child != null) { |
child.layout(new BoxConstraints.tight(_size)); |