ajinkya aher
ajinkya aher

Reputation: 51

How to add gesture detect swipe operation on list view builder in flutter

Need to implement bottom to top swipe on flutter screen which contains the List view builder widget that loads the list of element.

Upvotes: 0

Views: 309

Answers (1)

rasityilmaz
rasityilmaz

Reputation: 1389

   ScrollController _controller = ScrollController();

    void scrollToTop() {
      SchedulerBinding.instance!.addPostFrameCallback((_) {
        if (_controller.hasClients) {
          _controller.animateTo(
            _controller.position.maxScrollExtent,
            duration: const Duration(milliseconds: 100),
            curve: Curves.elasticInOut,
          );
        }
      });
    }

and use scrollToTop();

Upvotes: 1

Related Questions