LinearPercentIndicator constructor

LinearPercentIndicator({
  1. Key? key,
  2. Color fillColor = Colors.transparent,
  3. double percent = 0.0,
  4. double lineHeight = 5.0,
  5. double? width,
  6. Color? backgroundColor,
  7. LinearGradient? linearGradientBackgroundColor,
  8. LinearGradient? linearGradient,
  9. Color? progressColor,
  10. bool animation = false,
  11. int animationDuration = 500,
  12. bool animateFromLastPercent = false,
  13. bool isRTL = false,
  14. Widget? leading,
  15. Widget? trailing,
  16. Widget? center,
  17. bool addAutomaticKeepAlive = true,
  18. LinearStrokeCap? linearStrokeCap,
  19. Radius? barRadius,
  20. EdgeInsets padding = const EdgeInsets.symmetric(horizontal: 10.0),
  21. MainAxisAlignment alignment = MainAxisAlignment.start,
  22. MaskFilter? maskFilter,
  23. bool clipLinearGradient = false,
  24. Curve curve = Curves.linear,
  25. bool restartAnimation = false,
  26. VoidCallback? onAnimationEnd,
  27. 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.linearStrokeCap,
  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 ?? Color(0xFFB8C7CB);

  if (percent < 0.0 || percent > 1.0) {
    throw new Exception(
        "Percent value must be a double between 0.0 and 1.0, but it's $percent");
  }
}