我想画曲线像上面的图像谁能帮助我吗?
von4xj4u1#
尝试quadraticBezierTo与油漆shader .发挥与quadraticBezierTo的值,以满足您的需要。
quadraticBezierTo
shader
class MyCustomPainter extends CustomPainter { @override void paint(Canvas canvas, Size size) { Path path = Path() ..lineTo(20, 0) ..quadraticBezierTo(size.width / 2, size.height / 2, size.width, 0) ..lineTo(size.width, 20) ..quadraticBezierTo(size.width / 2, size.height / 1.3, 0, 20); Paint paint = Paint() ..shader = LinearGradient(colors: [Colors.blue, Colors.blue.withOpacity(.4)]) .createShader(Rect.fromLTWH(0, 0, size.width, size.height)); canvas.drawPath(path, paint); } @override bool shouldRepaint(covariant CustomPainter oldDelegate) => false; }
1条答案
按热度按时间von4xj4u1#
尝试
quadraticBezierTo
与油漆shader
.发挥与quadraticBezierTo
的值,以满足您的需要。