How to change color of CircularProgressIndicator

How can I change the color of CircularProgressIndicator?

The value of the color is an instance of Animation<Color>, but I am hoping there is a simpler way to change the color without trouble of the animation.


Solution 1:

This worked for me:

CircularProgressIndicator(valueColor: AlwaysStoppedAnimation<Color>(Colors.white))

Solution 2:

Three way to solve your problem

1) Using valueColor property

CircularProgressIndicator(
     valueColor: new AlwaysStoppedAnimation<Color>(Colors.blue),
),

2) Set accentColor in your main MaterialApp widget. This is best way because you dont want to set color all the time when you use CircularProgressIndicator widget

MaterialApp(
        title: 'My App',
        home: MainPAge(),
        theme: ThemeData(accentColor: Colors.blue),
),

3) Using Theme Widget

Theme(
      data: Theme.of(context).copyWith(colorScheme: ColorScheme(
            primary: Colors.red,
            // You should set other properties too
        )),
      child: new CircularProgressIndicator(),
)