Pratik Butani
Pratik Butani

Reputation: 62419

Squiggly Seekbar with Animation in Flutter

I am trying to implement Squiggly Seekbar with Animation in Flutter.

Here is the example how its looks like [Video Preview]:

enter image description here

I have tried some of the code as below

class MyWaveClipper extends CustomClipper<Path> {
  @override
  Path getClip(Size size) {
    var path = Path();
    debugPrint('Widget: ${size.width}, Height: ${size.height}');
    path.lineTo(0.0, 100.0);
    path.lineTo(0.0, size.height);
    path.lineTo(size.width, size.height);
    path.lineTo(size.width, 100.0);

    for (int i = 0; i < 10; i++) {
      if (i % 2 == 0) {
        path.quadraticBezierTo(
            size.width - (size.width / 16) - (i * size.width / 8),
            0.0,
            size.width - ((i + 1) * size.width / 8),
            size.height - (size.height * 0.8));
      } else {
        path.quadraticBezierTo(
            size.width - (size.width / 16) - (i * size.width / 8),
            size.height - (size.height * 0.6),
            size.width - ((i + 1) * size.width / 8),
            size.height - (size.height * 0.8));
      }
    }

    path.lineTo(0.0, 40.0);
    path.close();
    return path;
  }

  @override
  bool shouldReclip(CustomClipper<Path> oldClipper) {
    return false;
  }
}

I took an help of this blog, Can anyone help to make it infinite for Animation?

Upvotes: 3

Views: 431

Answers (1)

HannesH
HannesH

Reputation: 986

i just published a package that does exactly what you are looking for!

the github repo is linked there in case you are interested in its inner workings

Upvotes: 5

Related Questions