首页 > 解决方案 > Flutter ScrollController finout 最大偏移量

问题描述

我想为 CustomScrollView 制作某种自定义滚动进度指示器。

_scrollController = ScrollController()..addListener(_scroll);

void _scroll() {
    print('scrolled ${_scrollController.offset} from {??}');
}

有没有办法找出 _scrollController 最大偏移量?

或者我可以从滚动条小部件中获得一些价值吗?

标签: dartflutter

解决方案


所以你只需要

scrollController.position.maxScrollExtent

这为您提供了最大滚动范围ListView


推荐阅读