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

clickable_list_wheel_view 封面
套件詳情v0.2.0

clickable_list_wheel_view

ListWheelScrollView 的簡單包裝,允許子項目回應觸控(onTap)事件。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
1170
喜歡數
88
Pub 分數
150

安裝套件

flutter pub add clickable_list_wheel_view

套件介紹

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

一個簡單的 ListWheelScrollView 包裝器,可對單個子項啟用點擊互動。它透過允許使用者回應 onTap 事件來增強預設的滾動輪功能,非常適合在 Flutter 應用中建立互動式列表輪。該套件在維持 ListWheelScrollView 流暢滾動行為的同時,為每個項目添加了手勢辨識功能。相容所有主要平台,輕量且易於整合,設定需求極少。

適用情境

  • 互動式可捲動選單
  • 輪盤中的可點擊項目選擇
  • 帶有觸控反饋的可自訂下拉選單
  • 遊戲化UI組件
  • 動態內容導航

主要特色

  • ListWheelScrollView 項目的輕觸檢測
  • 最小化設定和整合
  • 跨平台相容性
  • 保留原生滾動行為
  • 輕量且高效
  • 支援自訂 onTap 回呼

適合對象

  • 開發人員建構互動式列表輪盤
  • 需要基於觸控選擇項目之應用
  • 具有旋轉或旋轉列表的 UI
  • 需要響應式輪組件的項目
  • Flutter 初學者探索觸控處理

使用建議

  • 可能需要額外的樣式以提供視覺反饋
  • 不適用於高頻率點擊場景
  • 限制為單次點擊互動
  • 性能取決於項目複雜度
  • 不支援長按或拖曳手勢

原始 README

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

pub package

clickable_list_wheel_view

Simple wrapper for ListWheelScrollView that allows children to respond on gesture (onTap) events

Animated

Installation

In the dependencies: section of your pubspec.yaml, add the following line:

dependencies:
    clickable_list_wheel_view: latest_version

Usage

Basic

You can get started really simple, just add


ClickableListWheelScrollView(
  scrollController: _scrollController,
  itemHeight: _itemHeight,
  itemCount: _itemCount,
  onItemTapCallback: (index) {
    print("onItemTapCallback index: $index");
  },
  child: ListWheelScrollView.useDelegate(
    controller: _scrollController,
    itemExtent: _itemHeight,
    physics: FixedExtentScrollPhysics(),
    overAndUnderCenterOpacity: 0.5,
    perspective: 0.002,
    onSelectedItemChanged: (index) {
      print("onSelectedItemChanged index: $index");
    },
    childDelegate: ListWheelChildBuilderDelegate(
      builder: (context, index) => _child(index),
      childCount: _itemCount,
    ),
  ),
)

Full Api

  ///  Required. The [child] which the wrapper will target to
  final ListWheelScrollView child;

  /// Required. Must be the same for list and wrapper
  final ScrollController scrollController;

  /// Optional. ListWheelScrollView height
  final double listHeight;

  /// Required. Height of one child in ListWheelScrollView
  final double itemHeight;

  /// Required. Number of items in ListWheelScrollView
  final int itemCount;

  /// If true the list will scroll on click
  final bool scrollOnTap;

  /// Set a handler for listening to a `tap` event
  final OnItemTapCallback onItemTapCallback;

  /// sets the duration of the scroll  animation
  final Duration animationDuration;
  
  /// use with ListWheelChildLoopingListDelegate
  final bool loop;

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。