Closed MrUncleX closed 1 year ago
onlyscrollsingle 设置成 false
是指这个值 onlyOneScrollInBody: false 吗? scroll_to_top.dart这文件没设置,里面值默认是false。
你是想代码控制吗? 你写的那个也可以。还有个outercontroller 就看你需求是什么
如这个视频只有视图可见时才滚的动,不可见的视图没滚动。 我是想实现控制不可见的视图也滚动到指定位置 https://user-images.githubusercontent.com/15188610/223954157-b073b273-b3f7-4711-aa11-505fbb640b7f.mp4
这个没用?
_key.currentState?.innerController.positions.forEach((position) {
position.jumpTo(0.0);
});
你要为每个列表 使用 AutomaticKeepAliveClientMixin 保持状态,不然切换的时候,position 已经从controller 里面 dettach了。。所以无效
使用了AutomaticKeepAliveClientMixin 结果还是不可见的视图没滚动。遍历的日志也有输出position。
使用了AutomaticKeepAliveClientMixin 结果还是不可见的视图没滚动。遍历的日志也有输出position。
而且切回去没滚动页面再点击滚动。输出position的地址没有变化,说明position没有销毁重建,keepAlive应该是生效了。
jump 和 animateTo 都被重载了。你只能设置 onlyOneScrollInBody 为 false ,才会都走。你发的demo onlyOneScrollInBody 是 true
比如有tab1 tab2 tab3 。当前视图是tab2.调用以下代码只有tab2滚动。其他的tab1 tab3 位置没有变化。我想要tab1 tab3都滚动到指定位置该如何做。 用的flutter版本是3.7.3,我是参考这个代码使用的。 https://github.com/fluttercandies/extended_nested_scroll_view/blob/master/example/lib/pages/complex/scroll_to_top.dart