CircularProgressIndicator constructor

const CircularProgressIndicator({
  1. Key? key,
  2. double? value,
  3. double? size,
  4. Color? color,
  5. Color? backgroundColor,
  6. double? strokeWidth,
  7. Duration duration = kDefaultDuration,
  8. bool animated = true,
  9. bool onSurface = false,
})

Creates a CircularProgressIndicator.

The component automatically handles both determinate and indeterminate modes based on whether value is provided. Size and colors adapt intelligently based on theme context unless explicitly overridden.

Parameters:

  • value (double?, optional): Progress completion (0.0-1.0) or null for indeterminate
  • size (double?, optional): Explicit diameter size override
  • color (Color?, optional): Primary progress arc color override
  • backgroundColor (Color?, optional): Background track color override
  • strokeWidth (double?, optional): Progress stroke thickness override
  • duration (Duration, default: kDefaultDuration): Animation duration for value changes
  • animated (bool, default: true): Whether to animate progress transitions
  • onSurface (bool, default: false): Whether displayed on colored background

Example:

CircularProgressIndicator(
  value: 0.6,
  size: 24.0,
  strokeWidth: 2.0,
  animated: true,
);

Implementation

const CircularProgressIndicator({
  super.key,
  this.value,
  this.size,
  this.color,
  this.backgroundColor,
  this.strokeWidth,
  this.duration = kDefaultDuration,
  this.animated = true,
  this.onSurface = false,
});