How to give background color to SliverGrid?

Viewed 5109

For ListView or GridView we wrap it with Container. But how can I give background color to SliverGrid?

2 Answers

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.

Or you could wrap your CustomScrollView by a Container having a background color:

Container(
    color: Colors.grey[200],
    child: CustomScrollView(
      slivers: <Widget>[]
    )
)
Related