如何更改CircularProgressIndicator的颜色?

颜色的值是Animation< color >的实例,但我希望有一种更简单的方法来改变颜色,没有动画的麻烦。


当前回答

CircularProgressIndicator(
  backgroundColor: Colors.amberAccent,
  semanticsLabel: 'Linear progress indicator',
),

其他回答

backgroundColor设置浅色,它看到像浅色背景色的圆,valueColor它是加载颜色,它将显示编译加载圆超过灰色

 CircularProgressIndicator(
        backgroundColor: Colors.gray,
        valueColor: AlwaysStoppedAnimation<Color>(Colors.black)
        )

在主。dart设置主题为accentColor, CircularProgressIndicator将使用该颜色

void main() => runApp(new MaterialApp(
  theme: ThemeData(primaryColor: Colors.red, **accentColor:  Colors.yellowAccent**),
  debugShowCheckedModeBanner: false,
  home: SplashPage()
));

这招对我很管用:

CircularProgressIndicator(valueColor: AlwaysStoppedAnimation<Color>(Colors.white))
<com.google.android.material.progressindicator.CircularProgressIndicator app:indicatorColor="@color/primaryColor" />

试试这个:

CircularProgressIndicator(
  color: Colors.yellow, // Change your color here
),