GayatriDunakhe / Flutter

All flutter programs
1 stars 1 forks source link

Customize Bezier Curve in Flutter #2

Open GayatriDunakhe opened 2 years ago

GayatriDunakhe commented 2 years ago

How can i achive this both curve in my flutter application I try to do but I endup with so weird results...

This is imge with I want to achive

image

And this is my stating code-

ClipPath(
        clipper: BackgroudCliper(),
        child: Container(
          height: 200,
          color: Colors.white.withOpacity(0.20),
        ),
      ),

class BackgroudCliper extends CustomClipper<Path>{
  @override
  Path getClip(Size size) {
    var path = Path();
    path.lineTo(0.0, size.height);
    path.lineTo(size.width, size.height);
    path.quadraticBezierTo(size.width / 20, size.height / 20, 0, size.height);
    path.close();
    return path;
  }
  @override
  bool shouldReclip(covariant CustomClipper<Path> oldClipper) => false;
}