简体   繁体   English

如何将 ScrollController 添加到 SliverList flutter

[英]How to add ScrollController to SliverList flutter

I can add ScrollController to a ListView.我可以将 ScrollController 添加到 ListView。 I was trying to do the same for SliverList but I realized there is no parameter to add a controller.我试图为 SliverList 做同样的事情,但我意识到没有参数可以添加 controller。 Is there any other way I can achieve this?还有其他方法可以实现吗? Thank you.谢谢你。

You cannot add it to a SliverList, you can however, add the controller to your parent CustomScrollView.您不能将它添加到 SliverList,但是您可以将 controller 添加到您的父级 CustomScrollView。 The SliverList comes inside the CustomScrollView and should give you the effect you want. SliverList 位于 CustomScrollView 内部,应该会给您想要的效果。 As you can see in the screenshot, you can add a controller to your CustomScrollView正如您在屏幕截图中看到的,您可以将 controller 添加到您的 CustomScrollView

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM