搜尋套件、儲存庫與 APP 分類

animated_segmented_tab_control 封面
套件詳情v2.2.0

animated_segmented_tab_control

一個可自訂的分段控制項,可用於標籤檢視中。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
4130
喜歡數
100
Pub 分數
160

安裝套件

flutter pub add animated_segmented_tab_control

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個可自訂的動畫分段控制項,專為與 Flutter 應用中的 TabView 無縫搭配而設計。它提供平滑的段落之間過渡效果,支援多種樣式選項,並透過動態視覺反饋增強使用者互動體驗。適用於需要直覺式標籤導航且具現代美學的應用程式。此套件可在所有主要平台(包括 Android、iOS、Web、macOS、Windows 和 Linux)上相容使用。

適用情境

  • 互動式標籤導航
  • 動態UI過渡
  • 可自訂的標籤介面
  • 跨平台標籤控制項
  • 儀表板中的使用者體驗增強
  • 表單部分切換

主要特色

  • 流暢的動畫過渡
  • 高度可自訂的外觀
  • 內建的 TabView 支援
  • 跨平台響應式設計
  • 與現有 Flutter 專案的輕鬆整合
  • 支援橫向和縱向佈局

適合對象

  • 開發跨平台應用的開發者
  • 尋求現代 UI 元件的設計師
  • 包含多個內容區域的應用程式
  • 需要互動式標籤體驗的專案
  • 優先考慮跨裝置的一致使用者體驗

使用建議

  • 可能需要為複雜主題添加額外的樣式
  • 大量分段帶來的效能影響
  • 有限的內建輔助功能
  • 依賴外部 TabView 實現
  • 未針對極高頻率的更新進行優化

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

A customizable segment tab control. Can be used with or without TabView.

Made in lanars.com.

pub package

Features

The package provides an advanced segmented control widget based on the TabController.

Usage

The package contains a SegmentedTabControl widget that requires a SegmentTab list.

SegmentedTabControl(
  tabs: [
    SegmentTab(
      label: 'Home',
    ),
  ],
)

SegmentedTabControl also requires a TabController. You can provide it with a DefaultTabController or instantiate a TabController instead.

DefaultTabController(
  length: 2,
  child: SegmentedTabControl(
    tabs: [
      SegmentTab(
        label: 'Home',
      ),
      SegmentTab(
        label: 'Account',
      ),
    ],
  ),
)

You can style the whole widget, an individual tab, or both. A value on the currently selected SegmentTab overrides the corresponding value on SegmentedTabControl.

SegmentedTabControl(
  barDecoration: BoxDecoration(
    color: Colors.grey.shade300,
    borderRadius: BorderRadius.circular(10),
  ),
  indicatorDecoration: BoxDecoration(
    color: Colors.orange.shade200,
    borderRadius: BorderRadius.circular(10),
  ),
  tabTextColor: Colors.black45,
  selectedTabTextColor: Colors.white,
  tabs: [
    SegmentTab(
      label: 'ACCOUNT',
      color: Colors.red.shade200,
    ),
    SegmentTab(
      label: 'HOME',
      backgroundColor: Colors.blue.shade100,
      selectedTextColor: Colors.black45,
      textColor: Colors.black26,
    ),
    const SegmentTab(label: 'NEW'),
  ],
)

Note that the text colors are read from the selected tab and applied to the whole bar, so textColor and selectedTextColor set the bar's label colors while that tab is selected rather than coloring only that one tab.

Change tracking logic is identical to TabBar logic.

DefaultTabController.of(context).index

or

_controller.index

Сustom tab content

Use SegmentTab.labelBuilder to show any widget like an icon.

The selected-tab highlight is produced by painting the tab row twice and clipping the upper copy to the indicator, so the builder is called once per layer and receives the color of the layer it is painting. Plain Icon and Text children inherit that color. Use color for anything that does not inherit it, such as a border or an SVG:

SegmentTab(
  label: 'NEW',
  labelBuilder: (context, color) => Container(
    padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
    decoration: BoxDecoration(
      border: Border.all(color: color),
      borderRadius: BorderRadius.circular(20),
    ),
    child: Text('NEW'),
  ),
)

Interactive children are not supported.

Additional information

If you have any ideas or are running into a bug, please submit an issue on github page: https://github.com/LanarsInc/animated-segmented-tab-control/issues

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。