【问题标题】:Flutter: Unable or change the sensibility of the slide between the tabs of a TabControllerFlutter:无法或更改 TabController 的选项卡之间滑动的敏感性
【发布时间】:2020-02-18 16:33:46
【问题描述】:

我有一个带有两个选项卡的 TabController。它们都带有列表视图(可滚动)。

问题在于在标签之间滑动所需的敏感性。如果用户以一个角度而不是垂直滚动一点,代码认为他想改变标签..

我正在尝试是否消除在选项卡之间滑动的可能性或改变它的敏感性。

这是我当前的标签栏。

return Column(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: <Widget>[
        TabBar(
          controller: _nestedTabController,
          indicatorColor: kHighlightColor,
          labelColor: kHighlightColor,
          unselectedLabelColor: Colors.black54,
          isScrollable: true,
          tabs: <Widget>[
            Tab(
              text: "Upload",
            ),
            Tab(
              text: "Favorite",
            ),
          ],
        ),
        Container(
          height: screenHeight * 0.75,
          child: TabBarView(
            physics: ScrollPhysics(),
            controller: _nestedTabController,
            children: <Widget>[
              Container(child: Profile()), //ListView
              Container(child: Favorite()), //ListView
            ],
          ),
        )
      ],
    );

也许我应该改变 TabBarView 的物理特性? 感谢您的帮助!

【问题讨论】:

    标签: flutter dart


    【解决方案1】:

    其实我只是换了物理方法:

    child: TabBarView(
            physics: NeverScrollableScrollPhysics(),
    

    并且无法在选项卡之间滑动。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-05
      • 2020-11-04
      • 2017-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多