英文:
Flutter Sliver App Bar not working with Custom Scroll View and controller
问题
我有一个用于我的应用的滑动悬浮应用栏,它位于嵌套滚动视图中,该嵌套滚动视图的主体是自定义滚动视图。我刚刚为自定义滚动视图添加了一个控制器,以便我可以有一个“返回顶部”的按钮,但在添加了这个控制器后,悬浮应用栏不再浮动。当我移除控制器时,它恢复正常工作。有人知道是否有办法为自定义滚动视图提供一个控制器,同时保持滑动应用栏的功能吗?
英文:
I have a Sliver Floating App Bar I have been using for my app, which sits in a Nested Scroll View, and the body of that Nested Scroll View is a Custom Scroll View. I just added a controller to the custom scroll view so that I can have a "go back to top" button, but upon adding this controller the floating app bar no longer floats. When I remove the controller it works again. Anybody know if there is a way to give a Custom scroll view a controller and still maintain the functionality of the sliver appbar?
答案1
得分: 1
没关系,我一发布问题就找到了答案(墨菲定律)。
你只需要将控制器传递给嵌套滚动视图,而不是自定义滚动视图。
英文:
Never mind, answered my question as soon as I posted it (murphy's law)
You just need to pass the controller to the nested scroll view instead of the custom scroll view.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论