Commit 3cfc9c4d authored by Hans Muller's avatar Hans Muller

Allow Stacks with no children or only poisitioned children

parent 6111301a
...@@ -172,14 +172,15 @@ abstract class RenderStackBase extends RenderBox ...@@ -172,14 +172,15 @@ abstract class RenderStackBase extends RenderBox
child = parentData.nextSibling; child = parentData.nextSibling;
} }
if (hasNonPositionedChildren) if (hasNonPositionedChildren) {
size = new Size(width, height); size = new Size(width, height);
else assert(size.width == constraints.constrainWidth(width));
assert(size.height == constraints.constrainHeight(height));
} else {
size = constraints.biggest; size = constraints.biggest;
}
assert(!size.isInfinite); assert(!size.isInfinite);
assert(size.width == constraints.constrainWidth(width));
assert(size.height == constraints.constrainHeight(height));
child = firstChild; child = firstChild;
while (child != null) { while (child != null) {
......
...@@ -10,6 +10,12 @@ void main() { ...@@ -10,6 +10,12 @@ void main() {
}); });
}); });
test('Can construct an empty Centered Stack', () {
testWidgets((WidgetTester tester) {
tester.pumpWidget(new Center(child: new Stack([])));
});
});
test('Can change position data', () { test('Can change position data', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
Key key = new Key('container'); Key key = new Key('container');
...@@ -108,6 +114,12 @@ void main() { ...@@ -108,6 +114,12 @@ void main() {
}); });
}); });
test('Can construct an empty Centered IndexedStack', () {
testWidgets((WidgetTester tester) {
tester.pumpWidget(new Center(child: new IndexedStack([])));
});
});
test('Can construct an IndexedStack', () { test('Can construct an IndexedStack', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
int itemCount = 3; int itemCount = 3;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment