createWavePath method

Path createWavePath(
  1. dynamic type
)

Implementation

Path createWavePath(type) {
  if(type=="up_wave_sh") {
    var path = Path();
    var size = Size(radius, 0);
    path.lineTo(
        -20, size.height); //start path with this if you are making at bottom

    var firstStart = Offset(size.width / 5, size.height + 50);
    //fist point of quadratic bezier curve
    var firstEnd = Offset(size.width / 2.35, size.height - 40.0);
    //second point of quadratic bezier curve
    path.quadraticBezierTo(
        firstStart.dx, firstStart.dy, firstEnd.dx, firstEnd.dy);

    var secondStart = Offset(size.width - (size.width / 3.24), size.height - 105);
    //third point of quadratic bezier curve
    var secondEnd = Offset(size.width, size.height - 10);
    //fourth point of quadratic bezier curve
    path.quadraticBezierTo(
        secondStart.dx, secondStart.dy, secondEnd.dx, secondEnd.dy);

    // path.lineTo(size.width, 0); //end with this path if you are making wave at bottom

    return path;
  }else if(type=="dwn_wave_sh"){
    var path = Path();
    var size = const Size(400, 0);
    var secondStart = Offset(size.width/7, size.height - 105);
    //third point of quadratic bezier curve
    var secondEnd = Offset(size.width/3, size.height - 10);
    //fourth point of quadratic bezier curve
    path.quadraticBezierTo(
        secondStart.dx, secondStart.dy, secondEnd.dx, secondEnd.dy);
    //start path with this if you are making at bottom

    var firstStart = Offset(size.width -(size.width/3), size.height+100 );
    //fist point of quadratic bezier curve
    var firstEnd = Offset(size.width, size.height-100 );
    //second point of quadratic bezier curve
    path.quadraticBezierTo(
        firstStart.dx, firstStart.dy, firstEnd.dx, firstEnd.dy);



    // path.lineTo(size.width, 0); //end with this path if you are making wave at bottom

    return path;

  }else{
    throw "Hi";
  }
}