CircularPercentIndicator constructor
CircularPercentIndicator({
- Key? key,
- double percent = 0.0,
- double lineWidth = 5.0,
- double startAngle = 0.0,
- required double radius,
- Color fillColor = Colors.transparent,
- Color backgroundColor = const Color(0xFFB8C7CB),
- Color? progressColor,
- double backgroundWidth = -1,
- LinearGradient? linearGradient,
- bool animation = false,
- int animationDuration = 500,
- Widget? header,
- Widget? center,
- bool addAutomaticKeepAlive = true,
- CircularStrokeCap circularStrokeCap = CircularStrokeCap.butt,
- Color? arcBackgroundColor,
- ArcType? arcType,
- bool animateFromLastPercent = false,
- bool reverse = false,
- Curve curve = Curves.linear,
- MaskFilter? maskFilter,
- bool restartAnimation = false,
- VoidCallback? onAnimationEnd,
- Widget? widgetIndicator,
- bool rotateLinearGradient = false,
Implementation
CircularPercentIndicator({
Key? key,
this.percent = 0.0,
this.lineWidth = 5.0,
this.startAngle = 0.0,
required this.radius,
this.fillColor = Colors.transparent,
this.backgroundColor = const Color(0xFFB8C7CB),
Color? progressColor,
//negative values ignored, replaced with lineWidth
this.backgroundWidth = -1,
this.linearGradient,
this.animation = false,
this.animationDuration = 500,
this.header,
this.footer,
this.center,
this.addAutomaticKeepAlive = true,
this.circularStrokeCap = CircularStrokeCap.butt,
this.arcBackgroundColor,
this.arcType,
this.animateFromLastPercent = false,
this.reverse = false,
this.curve = Curves.linear,
this.maskFilter,
this.restartAnimation = false,
this.onAnimationEnd,
this.widgetIndicator,
this.rotateLinearGradient = false,
}) : super(key: key) {
if (linearGradient != null && progressColor != null) {
throw ArgumentError(
'Cannot provide both linearGradient and progressColor');
}
_progressColor = progressColor ?? Colors.red;
assert(startAngle >= 0.0);
if (percent < 0.0 || percent > 1.0) {
throw Exception(
"Percent value must be a double between 0.0 and 1.0, but it's $percent");
}
if (arcType == null && arcBackgroundColor != null) {
throw ArgumentError('arcType is required when you arcBackgroundColor');
}
}