For ListView
or GridView
we wrap it with Container
. But how can I give background color to SliverGrid
?
Asked
Active
Viewed 6,043 times
7

CopsOnRoad
- 237,138
- 77
- 654
- 440

Figen Güngör
- 12,169
- 14
- 66
- 108
-
hi, do you solve this problem? – David Aug 19 '19 at 09:28
2 Answers
3
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.

Figen Güngör
- 12,169
- 14
- 66
- 108
1
Or you could wrap your CustomScrollView by a Container having a background color:
Container(
color: Colors.grey[200],
child: CustomScrollView(
slivers: <Widget>[]
)
)

woshitom
- 4,811
- 8
- 38
- 62
-
See this issue : https://github.com/flutter/flutter/issues/62818 Your answer gives a background to the whole CustomScrollView, not to SliverGrid. – DMonkey Sep 04 '20 at 15:21
-