Fix typo in LazyBlock (#3594)
We were returning instead of breaking out of the loop when we hit the last widget. Fixes #3593
This commit is contained in:
parent
620fb87567
commit
bb238eba88
@ -616,7 +616,7 @@ class _LazyBlockElement extends RenderObjectElement {
|
||||
newElement = inflateWidget(newWidget, previousChild);
|
||||
}, building: true);
|
||||
if (newElement == null)
|
||||
return;
|
||||
break;
|
||||
_children.add(newElement);
|
||||
}
|
||||
child = _getNextWithin(block, child);
|
||||
|
@ -279,4 +279,31 @@ void main() {
|
||||
});
|
||||
});
|
||||
|
||||
test('Underflow extents', () {
|
||||
testWidgets((WidgetTester tester) {
|
||||
double lastContentExtent;
|
||||
double lastContainerExtent;
|
||||
double lastMinScrollOffset;
|
||||
void handleExtendsChanged(double contentExtent, double containerExtent, double minScrollOffset) {
|
||||
lastContentExtent = contentExtent;
|
||||
lastContainerExtent = containerExtent;
|
||||
lastMinScrollOffset = minScrollOffset;
|
||||
}
|
||||
|
||||
tester.pumpWidget(new LazyBlockViewport(
|
||||
onExtentsChanged: handleExtendsChanged,
|
||||
delegate: new LazyBlockChildren(
|
||||
children: <Widget>[
|
||||
new Container(height: 100.0),
|
||||
new Container(height: 100.0),
|
||||
new Container(height: 100.0),
|
||||
]
|
||||
)
|
||||
));
|
||||
|
||||
expect(lastContentExtent, equals(300.0));
|
||||
expect(lastContainerExtent, equals(600.0));
|
||||
expect(lastMinScrollOffset, equals(0.0));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user