LinearPainter constructor

LinearPainter({
  1. double? circleWidth,
  2. double? progress,
  3. Widget? child,
  4. bool? fromRightToLeft,
  5. Color? progressBarColor,
  6. Color? backgroundColor,
  7. GFProgressHeadType? progressHeadType,
  8. LinearGradient? linearGradient,
  9. MaskFilter? mask,
  10. bool? clipLinearGradient,
})

Implementation

LinearPainter({
  this.circleWidth,
  this.progress,
  this.child,
  this.fromRightToLeft,
  this.progressBarColor,
  this.backgroundColor,
  this.progressHeadType,
  this.linearGradient,
  this.mask,
  this.clipLinearGradient,
}) {
  _paintBackground.color = backgroundColor ?? Colors.transparent;
  _paintBackground.style = PaintingStyle.stroke;
  _paintBackground.strokeWidth = circleWidth ?? 0.0;

  _paintLine.color = progress.toString() == '0.0' && progressBarColor != null
      ? progressBarColor ?? Colors.transparent.withOpacity(0)
      : progressBarColor ?? Colors.transparent;
  _paintLine.style = PaintingStyle.stroke;
  _paintLine.strokeWidth = circleWidth ?? 0.0;

  if (progressHeadType == GFProgressHeadType.square) {
    _paintLine.strokeCap = StrokeCap.butt;
  } else {
    _paintLine.strokeCap = StrokeCap.round;
    _paintBackground.strokeCap = StrokeCap.round;
  }
}