I have a list of containers which all have the same width and different heights. I want to fill the screen with them. From top left, to top right, to below, etc.
Similar thing can be seen in Pinterest and also Google Keep. Notice that the screen might resize so I don’t know the number of columns.
I have tried flutter_staggered_grid_view
. The most similar thing I could find was the Masonry grid. But it changed the width of the containers.
2
Answers
try adding this extension in your project:
this extension will listen to changes of screen width and return a matched value, so your gridView would be something like this:
so gridView crossAxisCount will increase as long as the screen width goes larger.
why don’t you use sliverGrid ?
it will be something like this :