Files
Edouard Marquez e3bc40fdf3 chore: Migration to Dart 3.8 (#6668)
* Migration to Dart 3.8

* New GA

* Fix dartdoc
2025-06-23 18:14:17 +02:00

32 lines
728 B
Dart

import 'package:flutter/rendering.dart';
class DashedLinePainter extends CustomPainter {
DashedLinePainter({
required Color color,
this.dashGap = 3.0,
this.dashSpace = 3.0,
}) : _paint = Paint()
..color = color
..strokeWidth = 1.0;
final double dashGap;
final double dashSpace;
final Paint _paint;
@override
void paint(Canvas canvas, Size size) {
double startX = 0.0;
while (startX < size.width) {
canvas.drawLine(Offset(startX, 0), Offset(startX + dashGap, 0), _paint);
startX += dashGap + dashSpace;
}
}
@override
bool shouldRepaint(DashedLinePainter oldDelegate) =>
dashGap != oldDelegate.dashGap || dashSpace != oldDelegate.dashSpace;
}