marcglasberg / indexed_list_view

Flutter package: Similar to a ListView, but lets you programmatically jump to any item, by index.
BSD 2-Clause "Simplified" License
251 stars 21 forks source link

Support for Shinkwrap property, like with ListView? #20

Closed rjgoodman closed 4 years ago

rjgoodman commented 4 years ago

Would it be possible to implement the shrinkwrap property, like ListView has, so that the IndexedListView doesn't expand to take up all of the available space given by the parent element when shrinkwrap=true?

marcglasberg commented 4 years ago

I don't think it really makes sense for this widget, since it works only for an infinite number of items. And since the number of items is infinite it would expand as much as it can, anyway, unless the widgets were to have zero length, which doesn't make sense.

Sorry, maybe this widget is not exactly what you need?

rjgoodman commented 4 years ago

I was thinking in terms of the left and right borders, not the top and bottom. Right now, the Indexed List View stretches to the full width of the parent.

marcglasberg commented 4 years ago

From the shrinkWrap docs:

Whether the extent of the scroll view in the scrollDirection should be determined by the contents being viewed. If the scroll view does not shrink wrap, then the scroll view will expand to the maximum allowed size in the scrollDirection. If the scroll view has unbounded constraints in the scrollDirection, then shrinkWrap must be true.

In other words, shrinkWrap doesn't affect the width of the parent when the scrollDirection is vertical. So even the original ListView can't do what you ask for.

rjgoodman commented 4 years ago

Ah, ok, I hadn't realized that. Thanks!

marcglasberg commented 4 years ago

No problem.