MultiSegmentLinearIndicator constructor

MultiSegmentLinearIndicator({
  1. Key? key,
  2. required List<SegmentLinearIndicator> segments,
  3. double lineHeight = 5.0,
  4. double? width,
  5. Radius? barRadius,
  6. EdgeInsets padding = const EdgeInsets.symmetric(horizontal: 10.0),
  7. bool animation = false,
  8. int animationDuration = 500,
  9. Curve curve = Curves.linear,
  10. bool animateFromLastPercent = false,
  11. VoidCallback? onAnimationEnd,
})

Creates a multi-segment linear progress indicator.

The sum of all segment percentages must be less than or equal to 1.0.

Implementation

MultiSegmentLinearIndicator({
  Key? key,
  required this.segments,
  this.lineHeight = 5.0,
  this.width,
  this.barRadius,
  this.padding = const EdgeInsets.symmetric(horizontal: 10.0),
  this.animation = false,
  this.animationDuration = 500,
  this.curve = Curves.linear,
  this.animateFromLastPercent = false,
  this.onAnimationEnd,
}) : super(key: key) {
  final sum = segments.fold<double>(
    0.0,
    (sum, segment) => sum + segment.percent,
  );
  if (sum > 1.0) {
    throw Exception(
      'The sum of all segment percentages must be less than or equal to 1.0, but got $sum',
    );
  }
}