我希望列表视图应该在应用程序启动时滚动到列表视图的最后一个元素。我该怎么做?我尝试在 initState 中滚动,但这引发了一个错误。我在 initState 中使用了这段代码:-
_scrollController.animateTo(
_scrollController.position.maxScrollExtent,
curve: Curves.easeOut,
duration: const Duration(milliseconds: 300),
);
我得到的错误是:-
ScrollController not attached to any scroll views.
初始化ScrollController
时,只需为initialScrollOffset
传递一个大值