Don't divide by zero

If there aren't any items, there's no point in computing which items to show.
This commit is contained in:
Adam Barth 2015-08-25 09:48:21 -07:00
parent 1867b58c40
commit b2de3a705b

View File

@ -439,7 +439,7 @@ abstract class ScrollableWidgetList extends Scrollable {
int itemShowCount = 0; int itemShowCount = 0;
Offset viewportOffset = Offset.zero; Offset viewportOffset = Offset.zero;
if (_containerExtent != null && _containerExtent > 0.0) { if (_containerExtent != null && _containerExtent > 0.0 && itemCount > 0) {
if (paddedScrollOffset < scrollBehavior.minScrollOffset) { if (paddedScrollOffset < scrollBehavior.minScrollOffset) {
// Underscroll // Underscroll
double visibleExtent = _containerExtent + paddedScrollOffset; double visibleExtent = _containerExtent + paddedScrollOffset;