dart - Flutter ScrollController finout 最大偏移量
问题描述
我想为 CustomScrollView 制作某种自定义滚动进度指示器。
_scrollController = ScrollController()..addListener(_scroll);
void _scroll() {
print('scrolled ${_scrollController.offset} from {??}');
}
有没有办法找出 _scrollController 最大偏移量?
或者我可以从滚动条小部件中获得一些价值吗?
解决方案
所以你只需要
scrollController.position.maxScrollExtent
这为您提供了最大滚动范围ListView
推荐阅读
- python - Python apscheduler 变量从后台计划任务到瓶子
- html - 如何在尊重原始布局的下拉菜单中设置固定位置?
- elasticsearch - 更新成本与在弹性搜索中插入
- php - 未在此服务器上找到新的联系表无效 URL
- ios - tel:// 方案自动格式化电话号码
- php - 如何从 opencart3 管理面板中的 MySQL Query 获取另一列值?
- android - 单击按钮时没有出现 ImageView
- linux - Unity:Linux 上所有网格过滤器上缺少网格
- azure - 如何使用 Powershell 7 将保留的 IP 地址分配给 Azure 上的云服务?
- android - 杀死带有 ContentProvider 代码的应用程序时无法找到 ContentProvider 信息