提交 101d4f9e 编写于 作者: H Hans Muller

Allow Stacks with no children or only poisitioned children

上级 593098b8
......@@ -172,14 +172,15 @@ abstract class RenderStackBase extends RenderBox
child = parentData.nextSibling;
}
if (hasNonPositionedChildren)
if (hasNonPositionedChildren) {
size = new Size(width, height);
else
assert(size.width == constraints.constrainWidth(width));
assert(size.height == constraints.constrainHeight(height));
} else {
size = constraints.biggest;
}
assert(!size.isInfinite);
assert(size.width == constraints.constrainWidth(width));
assert(size.height == constraints.constrainHeight(height));
child = firstChild;
while (child != null) {
......
......@@ -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', () {
testWidgets((WidgetTester tester) {
Key key = new Key('container');
......@@ -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', () {
testWidgets((WidgetTester tester) {
int itemCount = 3;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册