Flutter Sliver App Bar在使用自定义滚动视图和控制器时无法正常工作。

huangapple go评论58阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年2月18日 00:24:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/75486847.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定