【问题标题】:How to make scrolling page continue even when tabBarView reaches the top? Flutter即使 tabBarView 到达顶部,如何使滚动页面继续?扑
【发布时间】:2021-08-17 19:55:42
【问题描述】:

我运行的代码是 Griffins 在这里给出的代码:How To Move The TabBarView in the Center to The Top of the Page?

一切都与格里芬斯给出的代码相同。

但是,当 tabBar 滚动到顶部并锁定在那里时,每个小部件下的内容也停止滚动。

我希望小部件页面的内容继续滚动到其末尾,即使 tabBar 被锁定在顶部。

即使 SliverPersistentHeader 的 pinned 和 floating 被声明为 false,它所做的只是让 tabBar 向上滚动,tabBarView 的内容仍然在相似的位置结束。这发生在两个 tabBarViews 上。

所以我怀疑它与 sliverfillremaining 占据剩余高度有关。有没有办法克服这个问题?并显示tabBar的所有内容?

【问题讨论】:

    标签: flutter listview scroll tabs


    【解决方案1】:

    解决了。

    我将 SliverFillRemaining 更改为

    SliverToBoxAdapter(
                    child: AnimatedBuilder(
                        animation: tabController.animation,
                        builder: (ctx, child) {
                          if (tabController.index == 0) {
                            return Page1();
                          } else
                            return Page2();
                        }),
                  )
    

    【讨论】:

      猜你喜欢
      • 2021-08-06
      • 2010-11-11
      • 1970-01-01
      • 2011-05-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多