For ListView or GridView we wrap it with Container. But how can I give background color to SliverGrid?
How to give background color to SliverGrid?
6.5k Views Asked by Figen Güngör At
3
There are 3 best solutions below
2
On
Or you could wrap your CustomScrollView by a Container having a background color:
Container(
color: Colors.grey[200],
child: CustomScrollView(
slivers: <Widget>[]
)
)
0
On
Try DecoratedSliver as wrapper around SliverGrid.
This way, you can give any part of your Sliver* a decoration.
I'll just drop my solution here. I wrap my individual items with Container and give padding.
When the last row is not complete, I just add dummy item which is a Container with bg color until row is filled.