letsar / flutter_staggered_grid_view

A Flutter staggered grid view
MIT License
3.12k stars 508 forks source link

AlignedGridView grid - rebuild of all visible items on scroll #320

Open radzish opened 1 year ago

radzish commented 1 year ago

I am using AlignedGridView (with count constructor). I noticed that performance of scrolling is quite poor. While debugging I noticed that when I scroll grid, all visible items are rebuilt.

I replaced AlignedGridView with MasonryGridView and later does not have this issue. As a workaround I implemented item widgets cache, it improved performance dramatically, however I am not sure it is safe/efficient solution.

I am using 0.7.0 version.

r-i-c-o commented 5 months ago

Mostly it is because AlignedGridView uses SliverLayoutBuilder under the hood. It rebuilds on every scroll change.

doanngoctu95 commented 3 months ago

I have same issue, so what solution for this? Using MasonryGridView instead is good @radzish? Thank you so much!

sedax90 commented 2 weeks ago

I have same issue, so what solution for this? Using MasonryGridView instead is good @radzish? Thank you so much!

I've switched to MasonryGridView with same settings and all works fine