LinearPainter constructor
LinearPainter({
- required double lineWidth,
- required double progress,
- required bool isRTL,
- required Color progressColor,
- required Color backgroundColor,
- LinearStrokeCap? linearStrokeCap = LinearStrokeCap.butt,
- LinearGradient? linearGradient,
- MaskFilter? maskFilter,
- required bool clipLinearGradient,
- LinearGradient? linearGradientBackgroundColor,
Implementation
LinearPainter({
required this.lineWidth,
required this.progress,
required this.isRTL,
required this.progressColor,
required this.backgroundColor,
this.linearStrokeCap = LinearStrokeCap.butt,
this.linearGradient,
this.maskFilter,
required this.clipLinearGradient,
this.linearGradientBackgroundColor,
}) {
_paintBackground.color = backgroundColor;
_paintBackground.style = PaintingStyle.stroke;
_paintBackground.strokeWidth = lineWidth;
_paintLine.color = progress.toString() == "0.0"
? progressColor.withOpacity(0.0)
: progressColor;
_paintLine.style = PaintingStyle.stroke;
_paintLine.strokeWidth = lineWidth;
if (linearStrokeCap == LinearStrokeCap.round) {
_paintLine.strokeCap = StrokeCap.round;
} else if (linearStrokeCap == LinearStrokeCap.butt) {
_paintLine.strokeCap = StrokeCap.butt;
} else {
_paintLine.strokeCap = StrokeCap.round;
_paintBackground.strokeCap = StrokeCap.round;
}
}