casvanluijtelaar / reorderable_grid

A Flutter inplementation of the reorderable grid UI pattern, closely mimics Flutters exisiting ReorderableList
https://pub.dev/packages/reorderable_grid
MIT License
61 stars 17 forks source link

All items gets rebuilt when dragging a single item #41

Open naamapps opened 3 months ago

naamapps commented 3 months ago

Hi, Is it normal for this package that all grid items gets rebuilt when dragging a single item? (even when just hovering in place without actually reordering anything). My app takes a major performance hit because of this. I would expect that the items won't get rebuilt but only their transform would be changed. Is there any way to optimize this?

Thanks

casvanluijtelaar commented 3 months ago

Hey, do you have some more data about what unexpected rebuilds are happening? when dragging an item, all items will have to recalculate their position and constraints.

naamapps commented 2 months ago

Hey @casvanluijtelaar, Should it really rebuild All items? I think an optimization could really improve this package - so it would know which items needs rebuilding lazily. For example I have a grid of 2 items in a row, when ordering an item in the first row to the second position in the same row, not all items needs rebuilding, but just the two items in the first row..

casvanluijtelaar commented 2 months ago

maybe probably, but right now these items need to recalculate their position to know if they should move or not. if you have suggestions, I'd love to hear them!

naamapps commented 2 months ago

Does the item need to rebuild even if it's position is not changed? Every finger movement causes a rebuild for all items. I think maybe a check if the position is changed then the item needs to be rebuilt. Don't know if it's possible though.