MultiSegmentLinearIndicator constructor
MultiSegmentLinearIndicator({
- Key? key,
- required List<
SegmentLinearIndicator> segments, - double lineHeight = 5.0,
- double? width,
- Radius? barRadius,
- EdgeInsets padding = const EdgeInsets.symmetric(horizontal: 10.0),
- bool animation = false,
- int animationDuration = 500,
- Curve curve = Curves.linear,
- bool animateFromLastPercent = false,
- 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',
);
}
}