ariedov / flutter_snaplist

A small library for creating snapping lists.
MIT License
452 stars 53 forks source link

snaplistController.setPosition don't have animation #19

Open phattranky opened 5 years ago

phattranky commented 5 years ago

I try to using setPosition. The functional working well except it doesn't have animation. It just jumps directly to the position. I try to set snipDuration but not effect. Can anyone help me?. Thanks

thanhnguyen1121 commented 4 years ago

Can you show me how to use Snaplistcontroller...plz

nhank-group commented 4 years ago

You can custom your own animation In snaplist_view.dart file, change:

bloc.explicitPositionChangeStream.listen((offset) {
      print("new offset: $offset");
      _controller.jumpTo(offset);
    });

to:

bloc.explicitPositionChangeStream.listen((offset) {
      _controller.animateTo(offset,
          duration: Duration(milliseconds: 300), curve: Curves.fastOutSlowIn);
    });