即使tabBarView到达顶部,如何使滚动页面继续?扑 [英] How to make scrolling page continue even when tabBarView reaches the top? Flutter
问题描述
我运行的代码是 Griffins 在这里给出的代码:如何将中间的TabBarView移到页面顶部?
The code I ran was the code that was given by Griffins here: How To Move The TabBarView in the Center to The Top of the Page?
一切都和 Griffins 给出的代码一样.
Everything is the same as the code given by Griffins.
然而,当 tabBar 滚动到顶部并锁定在那里时,每个小部件下的内容也停止滚动.
However, when the tabBar was scrolled to the top and locked there, the content under each widget stopped scrolling too.
我希望小部件页面的内容继续滚动到最后,即使 tabBar 被锁定在顶部.
I want the content of the widget page to continue scrolling to its end, even when the tabBar is locked at the top.
即使SliverPersistentHeader的pinned和floating被声明为false,它所做的只是让tabBar向上滚动,tabBarView的内容仍然在相似的位置结束.这发生在两个 tabBarViews 上.
Even if pinned and floating of SliverPersistentHeader was declared false, all it does is just to make the tabBar scrolled up, the content of the tabBarView still ends at the similar position. This is occurring for both tabBarViews.
所以我怀疑这与 sliverfillremaining 占据剩余高度有关.有没有办法克服这个问题?并显示 tabBar 的所有内容?
So I'm suspecting it has something to do with the sliverfillremaining taking up the remaining height. Is there a way to overcome this? and show all the content of the tabBar?
推荐答案
已解决.
我将 SliverFillRemaining 更改为
I changed the SliverFillRemaining to
SliverToBoxAdapter(
child: AnimatedBuilder(
animation: tabController.animation,
builder: (ctx, child) {
if (tabController.index == 0) {
return Page1();
} else
return Page2();
}),
)
这篇关于即使tabBarView到达顶部,如何使滚动页面继续?扑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!