Page MenuHomec4science

linePainter.Dart
No OneTemporary

File Metadata

Created
Tue, Nov 12, 19:23

linePainter.Dart

import 'package:flutter/material.dart';
class LinePainter2 extends CustomPainter {
Paint _paint;
List<double> x;
List<double> y;
var path = Path();
//var patendpathh=path();
LinePainter2(this.x, this.y) {
_paint = Paint()
..color = Colors.blue
..strokeWidth = 3.0
..style = PaintingStyle.stroke;
}
@override
void paint(Canvas canvas, Size size) {
// path.moveTo(0, 0);
//canvas.restore();
// print(x);
for (int i = 3; i < x.length - 3; i++) {
path.moveTo(x[i - 2], y[i - 2]);
path.lineTo(x[i - 1], y[i - 1]);
canvas.drawPath(path, _paint);
// canvas.save();
}
// path.moveTo(0, 0);
//path.lineTo(20, 20);
//canvas.drawPath(path, _paint);
}
@override
bool shouldRepaint(LinePainter2 oldDelegate) {
return true;
}
}

Event Timeline