From b6316f7eacf72d3f815b19b62b16a78f506d448d Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Tue, 18 Aug 2015 09:57:54 -0700 Subject: [PATCH] Container should expand in dimensions without constraints ... as long as it doesn't have a child. If it has a child, it should size according to that child. Essentially, if Container doesn't have a child, it pretends like it has a child that expands to fill its constraints. --- sky/packages/sky/lib/widgets/basic.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sky/packages/sky/lib/widgets/basic.dart b/sky/packages/sky/lib/widgets/basic.dart index 344dca79011..2da0fd258a6 100644 --- a/sky/packages/sky/lib/widgets/basic.dart +++ b/sky/packages/sky/lib/widgets/basic.dart @@ -339,7 +339,7 @@ class Container extends Component { Widget build() { Widget current = child; - if (child == null && width == null && height == null) + if (child == null && (width == null || height == null)) current = new ConstrainedBox(constraints: BoxConstraints.expand); if (padding != null) @@ -348,12 +348,13 @@ class Container extends Component { if (decoration != null) current = new DecoratedBox(decoration: decoration, child: current); - if (width != null || height != null) + if (width != null || height != null) { current = new SizedBox( width: width, height: height, child: current ); + } if (constraints != null) current = new ConstrainedBox(constraints: constraints, child: current);