LinearPercentIndicator constructor
LinearPercentIndicator({
- Key? key,
- Color fillColor = Colors.transparent,
- double percent = 0.0,
- double lineHeight = 5.0,
- double? width,
- Color? backgroundColor,
- LinearGradient? linearGradientBackgroundColor,
- LinearGradient? linearGradient,
- Color? progressColor,
- bool animation = false,
- int animationDuration = 500,
- bool animateFromLastPercent = false,
- bool isRTL = false,
- Widget? leading,
- Widget? trailing,
- Widget? center,
- bool addAutomaticKeepAlive = true,
- Radius? barRadius,
- EdgeInsets padding = const EdgeInsets.symmetric(horizontal: 10.0),
- MainAxisAlignment alignment = MainAxisAlignment.start,
- MaskFilter? maskFilter,
- bool clipLinearGradient = false,
- Curve curve = Curves.linear,
- bool restartAnimation = false,
- VoidCallback? onAnimationEnd,
- Widget? widgetIndicator,
Implementation
LinearPercentIndicator({
Key? key,
this.fillColor = Colors.transparent,
this.percent = 0.0,
this.lineHeight = 5.0,
this.width,
Color? backgroundColor,
this.linearGradientBackgroundColor,
this.linearGradient,
Color? progressColor,
this.animation = false,
this.animationDuration = 500,
this.animateFromLastPercent = false,
this.isRTL = false,
this.leading,
this.trailing,
this.center,
this.addAutomaticKeepAlive = true,
this.barRadius,
this.padding = const EdgeInsets.symmetric(horizontal: 10.0),
this.alignment = MainAxisAlignment.start,
this.maskFilter,
this.clipLinearGradient = false,
this.curve = Curves.linear,
this.restartAnimation = false,
this.onAnimationEnd,
this.widgetIndicator,
}) : super(key: key) {
if (linearGradient != null && progressColor != null) {
throw ArgumentError('Cannot provide both linearGradient and progressColor');
}
_progressColor = progressColor ?? Colors.red;
if (linearGradientBackgroundColor != null && backgroundColor != null) {
throw ArgumentError('Cannot provide both linearGradientBackgroundColor and backgroundColor');
}
_backgroundColor = backgroundColor ?? const Color(0xFFB8C7CB);
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");
}
}