简体   繁体   English

Flutter:如何为 BouncingScrollPhysics 设置背景颜色?

[英]Flutter : How to set background color for BouncingScrollPhysics?

When i set BouncingScrollPhysics for SingleChildScrollView , the backgound appears to be white when it bounces.当我为SingleChildScrollView设置BouncingScrollPhysics时,背景在反弹时看起来是white的。 Is there any way to change it to custom colors?有没有办法将其更改为自定义 colors?

You will need to change the background color of the Widget over which you are rendering SingleChildScrollView Widget.您将需要更改在其上呈现 SingleChildScrollView 小部件的小部件的背景颜色。 If your SingleChildScrollView is directly under Scaffold, then set backgroundColor property of your Scaffold to the color you desire.如果您的 SingleChildScrollView 直接位于 Scaffold 下,则将 Scaffold 的backgroundColor属性设置为您想要的颜色。

I solved this way我这样解决了

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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