mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Allow Stacks with no children or only poisitioned children
This commit is contained in:
parent
593098b882
commit
101d4f9e7e
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user