У меня есть CustomPainter
, который выглядит следующим образом:
class MyPainter extends CustomPainter {
Offset left, top, right, bottom;
MyPainter({this.left, this.top, this.right, this.bottom});
@override
void paint(Canvas canvas, Size size) {
Paint pp = Paint()
..color = Colors.blue
..strokeCap = StrokeCap.round
..strokeWidth = 10;
Paint p = Paint()
..color = Colors.red
..style = PaintingStyle.stroke
..strokeWidth = 2;
Path ph = Path();
ph.moveTo(left.dx, left.dy);
ph.quadraticBezierTo(top.dx, top.dy, right.dx, right.dy);
canvas.drawPoints(PointMode.points, [left, top, right, bottom], pp);
canvas.drawPath(ph, p);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return true;
}
}
И вот результат: https://imgur.com/a/m4i6WEA
Как бы я ни хотел, чтобы линия кривой прошла контрольную точку.Примерно так: https://imgur.com/a/cumbAVz
Как мне это сделать?!