搜尋套件、儲存庫與 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

原始碼儲存庫

使用此套件的專案