搜索插件、代码仓与 APP 分类

插件详情v5.0.0

extended_tabs

一个功能强大的官方扩展库,用于 Tab/TabBar/TabView,支持在当前标签页超出滚动范围时滚动父级或子级标签页,并可设置滚动方向和缓存范围。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1.3万
喜欢数
175
Pub 分数
140

安装插件

flutter pub add extended_tabs

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

ExtendedTabs 是 Flutter 的 Tab、TabBar 和 TabView 小部件的强大官方扩展库。它通过在发生越界滚动时启用到祖先或子标签的滚动传播,增强了默认标签行为,支持可自定义的滚动方向,并允许设置缓存范围以提高性能。专为复杂的标签导航场景设计,在所有主要平台上,为嵌套或可滚动的标签结构提供更流畅的用户体验。

适合场景

  • 嵌套标签导航
  • 可滚动标签界面
  • 性能优化的标签视图
  • 自定义滚动方向处理
  • 动态标签内容加载

主要特点

  • 父标签和子标签之间的过度滚动传播
  • 可配置的滚动方向
  • 可调节的缓存范围
  • 官方扩展,具有强大的平台支持
  • 与现有选项卡小部件的无缝集成

适合对象

  • 开发复杂标签式界面的开发者
  • 需要嵌套或可滚动标签布局的应用
  • 注重性能和流畅滚动的团队
  • 针对多个平台的项目
  • 具有动态标签内容的 Flutter 应用程序

使用建议

  • 需要理解 Flutter 的滚动系统
  • 可能增加简单标签页实现的复杂性
  • 最适合高级用例,而不是基本标签需求
  • 除了基本示例外,文档有限
  • 可能需要手动管理滚动控制器

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

extended_tabs

pub package GitHub stars GitHub forks GitHub license GitHub issues FlutterCandies QQ 群

Language: English | 中文简体

A powerful official extension library of Tab/TabBar/TabView, which support to scroll ancestor or child Tabs when current is overscroll, and set scroll direction and cache extent.

Web demo for ExtendedTabs

Usage

dependencies:
  flutter:
    sdk: flutter
  extended_tabs: any
CarouselIndicator

Show tab indicator as Carousel style

   CarouselIndicator(
     controller: _controller,
     selectedColor: Colors.white,
     unselectedColor: Colors.grey,
     strokeCap: StrokeCap.round,
     indicatorPadding: const EdgeInsets.all(5),
   ),
ColorTabIndicator

Show tab indicator with color fill

    TabBar(
      indicator: ColorTabIndicator(Colors.blue),
      labelColor: Colors.black,
      tabs: [
        Tab(text: "Tab0"),
        Tab(text: "Tab1"),
      ],
      controller: tabController,
    )
Link
  /// if link is true and current tabbarview over scroll,
  /// it will check and scroll ancestor or child tabbarView.
  /// default is true
  final bool link;
  
  ExtendedTabBarView(
    children: <Widget>[
      List("Tab000"),
      List("Tab001"),
      List("Tab002"),
      List("Tab003"),
    ],
    controller: tabController2,
    link: true,
  )
ScrollDirection
  /// The axis along which the tab bar and tab view scrolls.
  ///
  /// Defaults to [Axis.horizontal].
  final Axis scrollDirection;

  Row(
    children: <Widget>[
      ExtendedTabBar(
        indicator: const ColorTabIndicator(Colors.blue),
        labelColor: Colors.black,
        scrollDirection: Axis.vertical,
        tabs: const <ExtendedTab>[
          ExtendedTab(
            text: 'Tab0',
            scrollDirection: Axis.vertical,
          ),
          ExtendedTab(
            text: 'Tab1',
            scrollDirection: Axis.vertical,
          ),
        ],
        controller: tabController,
      ),
      Expanded(
        child: ExtendedTabBarView(
          children: <Widget>[
            const ListWidget(
              'Tab1',
              scrollDirection: Axis.horizontal,
            ),
            const ListWidget(
              'Tab1',
              scrollDirection: Axis.horizontal,
            ),
          ],
          controller: tabController,
          scrollDirection: Axis.vertical,
        ),
      )
    ],
      )
CacheExtent
  /// cache page count
  /// default is 0.
  /// if cacheExtent is 1, it has two pages in cache
  final int cacheExtent;
  
  ExtendedTabBarView(
    children: <Widget>[
      List("Tab000"),
      List("Tab001"),
      List("Tab002"),
      List("Tab003"),
    ],
    controller: tabController2,
    link: true,
    cacheExtent: 1,
  )  
ShouldIgnorePointerWhenScrolling
  /// Whether the contents of the widget should ignore [PointerEvent] inputs.
  ///
  /// Setting this value to true prevents the use from interacting with the
  /// contents of the widget with pointer events. The widget itself is still
  /// interactive.
  ///
  /// For example, if the scroll position is being driven by an animation, it
  /// might be appropriate to set this value to ignore pointer events to
  /// prevent the user from accidentally interacting with the contents of the
  /// widget as it animates. The user will still be able to touch the widget,
  /// potentially stopping the animation.
  ///
  ///
  /// if true, child can't accept event before [ExtendedPageView],[ExtendedScrollable] stop scroll.
  ///
  ///
  /// if false, child can accept event before [ExtendedPageView],[ExtendedScrollable] stop scroll.
  /// notice: we don't know there are any issues if we don't ignore [PointerEvent] inputs when it's scrolling.
  ///
  ///
  /// Two way to solve issue that child can't hittest before [PageView] stop scroll.
  /// 1. set [shouldIgnorePointerWhenScrolling] false
  /// 2. use LessSpringClampingScrollPhysics to make animation quickly
  ///
  /// default is true.
  final bool shouldIgnorePointerWhenScrolling;
  
  ExtendedTabBarView(
    children: <Widget>[
      List("Tab000"),
      List("Tab001"),
      List("Tab002"),
      List("Tab003"),
    ],
    controller: tabController2,
    shouldIgnorePointerWhenScrolling: false,
    cacheExtent: 1,
  )  

所属分类

依赖

依赖清单 1 项

  • sync_scroll_library^1.1.0

源码仓库

使用此插件的项目