简体   繁体   中英

How to change the background color in listview

I'm using the below code to display userResults list using listview widget. I want the background color of the individual rows to be light gray. but its using my theme primary color. could you please provide suggestions?


return Container(
          color: Colors.grey[50],
          child: ListView(children: userResults),
        );

image

That code should work however if any of the children of that Container have a color property it will over ride the grey color you have assigned. As for the PrimaryColor property that should not be coming into play here have you assigned any other ThemeData besides PrimaryColor

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM