ScrollController not attached to any scroll views

前端 未结 11 1175
难免孤独
难免孤独 2021-01-17 07:22

I\'m using CustomScrollView, and providing it with a controller. ScrollController works, I even added a listener to it and print out the position of the scroll view.

11条回答
  •  逝去的感伤
    2021-01-17 07:53

    Initialize the scrollController:

    ScrollController _scrollController = ScrollController(); 
    

    Use the code bellow where you want to scroll:

    SchedulerBinding.instance.addPostFrameCallback((_) {
      _scrollController.jumpTo(_scrollController.position.maxScrollExtent);
    });
    

提交回复
热议问题