Created
April 5, 2020 13:45
-
-
Save divyanshub024/2b317c36f433c17852076237d9fc87dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LinePainter extends CustomPainter { | |
final double progress; | |
LinePainter({this.progress}); | |
Paint _paint = Paint() | |
..color = Colors.black | |
..strokeWidth = 4.0 | |
..style = PaintingStyle.stroke | |
..strokeJoin = StrokeJoin.round; | |
@override | |
void paint(Canvas canvas, Size size) { | |
var path = Path(); | |
path.moveTo(0, size.height / 2); | |
path.lineTo(size.width * progress, size.height / 2); | |
canvas.drawPath(path, _paint); | |
} | |
@override | |
bool shouldRepaint(LinePainter oldDelegate) { | |
return oldDelegate.progress != progress; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment