Is there any way I can use a SliverGrid outside a ScrollView?

Issue

I was trying to use a GridView without a scrolling behavior, and I achieved it by setting the “primary” attribute to false. By doing so I noticed that when one scrollable widget are nested to another, the card shadow gets this weird effect.

Note the difference between the shadow of the two cards

So I tried to get it working by using a SliverGrid, but I found out that I need to wrap it in a CustomScrollView or related, and by doing so I would create the shadow effect again. Is there any way I can use SliverGrid that allows me not to have a scrolling behavior?

Solution

There’s a much easier solution.
Use Wrap instead of GridView

Wrap is similar to Column and Row. But it’s two dimensional.
It also has the cool ability to control spacing between items.

Answered By – Rémi Rousselet

Answer Checked By – Clifford M. (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.