简体   繁体   中英

Flutter : How to set background color for BouncingScrollPhysics?

When i set BouncingScrollPhysics for SingleChildScrollView , the backgound appears to be white when it bounces. Is there any way to change it to custom colors?

You will need to change the background color of the Widget over which you are rendering SingleChildScrollView Widget. If your SingleChildScrollView is directly under Scaffold, then set backgroundColor property of your Scaffold to the color you desire.

I solved this way

Scaffold(
  backgroundColor: Colours.background,
    body: SingleChildScrollView(
      child: Container(
        color: Colors.white,
        child: Column(
          children: [
            ....
          ],
        ),
      ),
      physics: BouncingScrollPhysics(),
    ));

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