Theme responsible for CircularProgressIndicator

Viewed 50

I want to give every CircularProgressIndicator a color in my app but what attribute is responsible for it in MaterialApp widget:

MaterialApp(
   theme: ThemeData(
     // what is the attribute for this widget.
  )
)

I used both accentColor and colorScheme.secondary but still not change. enter image description here

2 Answers

You can use accentColor to change the color of CircularProgressIndicator. It will look like this:

 theme: ThemeData(
         accentColor: Colors.red,

EDIT:

In the newest version of Flutter, you should use colorScheme instead of accentColor.

  colorScheme: ColorScheme.fromSwatch().copyWith(
    secondary: Colors.red, 
  ),

In ThemeData there is progressIndicatorTheme attribute which you can assign ProgressIndicatorThemeData constructor to it, and there you can change the default color of ProgressIndicator.

Related