diff --git a/lib/src/layer/polyline_layer.dart b/lib/src/layer/polyline_layer.dart index 8ab7ff5de..30c68bc03 100644 --- a/lib/src/layer/polyline_layer.dart +++ b/lib/src/layer/polyline_layer.dart @@ -174,7 +174,7 @@ class PolylinePainter extends CustomPainter { if (polylineOpt.isDotted) { var spacing = polylineOpt.strokeWidth * 1.5; canvas.saveLayer(rect, Paint()); - if (borderPaint != null) { + if (borderPaint != null && filterPaint != null) { _paintDottedLine( canvas, polylineOpt.offsets, borderRadius, spacing, borderPaint); _paintDottedLine( @@ -185,12 +185,10 @@ class PolylinePainter extends CustomPainter { } else { paint.style = PaintingStyle.stroke; canvas.saveLayer(rect, Paint()); - if (borderPaint != null) { - if (filterPaint != null) { - filterPaint.style = PaintingStyle.stroke; - _paintLine(canvas, polylineOpt.offsets, borderPaint); - } - borderPaint?.style = PaintingStyle.stroke; + if (borderPaint != null && filterPaint != null) { + borderPaint.style = PaintingStyle.stroke; + _paintLine(canvas, polylineOpt.offsets, borderPaint); + filterPaint.style = PaintingStyle.stroke; _paintLine(canvas, polylineOpt.offsets, filterPaint); } _paintLine(canvas, polylineOpt.offsets, paint);