flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.29k stars 27.52k forks source link

SliverWrap widget #97544

Open Piinks opened 2 years ago

Piinks commented 2 years ago

We should consider adding a sliver wrap widget. This widget would function like the Wrap widget, but support scrolling.

SliverGrid currently relies on users specifying a fixed cross axis count, or a max extent for the cross axis. Further, the only layout we support (SliverGridRegularTileLayout) assumes that the items in the grid are all the same size as well as evenly spaced.

Adding a SliverWrap widget could provide a lot more flexibility for users' layouts.

Piinks commented 2 years ago

I thought of this in researching the native iOS UICollectionView The line wrapping feature is provided out of the box.

Docs: https://developer.apple.com/documentation/uikit/uicollectionview

In the above link, there is mention of supplementary views for headers and such, but we would not need that if we approached this as a SliverWrap widget. You could add separators and headings, or whatever sliver you like in between sections.

Further, this is concept is very similar to the UICollectionViewFlowLayout section here: https://developer.apple.com/documentation/uikit/views_and_controls/collection_views/layouts/customizing_collection_view_layouts

It would be nice as an adaptive grid-like scrolling widget, since the line wrap would be determined by the screen size.

Piinks commented 2 years ago

Similar to https://github.com/flutter/flutter/issues/97551, not the same, but from the same brainstorming session

snat-s commented 2 years ago

Hi! I've been working on a design doc for this issue. If anyone is interested you should check this out: https://docs.google.com/document/d/1auZtWT1T5CkUKOUTUld8rF91iN7PvQoOF0IlBNXiDSo/edit?usp=sharing

SixSheeppp commented 1 year ago

Any updates?