0

enter image description here

I want to draw curve like image above can anyone help me if can ?

Mariam Younes
  • 389
  • 6
  • 29

1 Answers1

0

Try quadraticBezierTo with Paint shader. play with quadraticBezierTo's value to meet your need.

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;
}

enter image description here

Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56