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

roller_list 封面
套件詳情v1.0.4

roller_list

一個列表組件,其運作方式類似於滾輪:在有限的項目集合上無限滾動。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
970
喜歡數
31
Pub 分數
160

安裝套件

flutter pub add roller_list

套件介紹

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

RollerList 是一個 Flutter 小部件,模擬物理滾輪的行為,允許在有限的項目集合中實現無限滾動。它非常適合用來建立吸引人且互動性強的介面,例如獎品輪盤或數字旋轉器。該小部件可平滑地動畫化項目過渡,並支援自訂樣式與事件回呼。專為跨平台使用設計,在 Android、iOS、Web、macOS、Windows 和 Linux 上都能順暢運行。非常適合遊戲化體驗與獎勵系統。

適用情境

  • 遊戲化使用者介面
  • 獎品輪盤實現
  • 數字或項目旋轉器
  • 互動獎勵系統
  • 數位老虎機
  • 動畫選擇器

主要特色

  • 有限項目中的無限滾動
  • 平滑的動畫過渡
  • 跨平台相容性
  • 可自訂項目外觀
  • 選擇事件回調
  • 支援多個平台

適合對象

  • 遊戲開發者
  • 獎勵應用創作者
  • 互動式UI設計工具
  • Flutter 初學者探索動畫
  • 需要引人入勝的選擇機制的應用程式

使用建議

  • 最適合小型到中型項目集
  • 對於大型資料集,可能需要進行效能調校
  • 僅限於視覺吸引力,而非複雜的資料處理
  • 不適合標準列表導航
  • 需要仔細設計以確保可存取性

原始 README

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

Codemagic build status

roller_list package

This widget is a list of values distributed in a circle. The main rules of the list are: a user could scroll it in one direction endlessly, list values are limited and repeated in the same order over and over again. Possible usage scheme: -time selection -piano notes selection -choice of any limited number of items, where it is not important what should go first and what should go last.

Example

You can check Flutter for web build here Or see how it looks like on iphone:

How to use

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

roller_list: <latest version>

Then import this class:

import 'package:roller_list/roller_list.dart';

And add your list like this (with only programmatical scroll):

RollerList(
 items: slots,
 enabled: false,
 key: leftRoller,
)

Or like this (with enabled scroll):

RollerList(
  items: months,
  onSelectedIndexChanged: _changeMonths,
  initialIndex: 1,
)

where months is a list of widgets:

static const MONTHS = {
    "January": 31,
    "February": 29,
    "March": 31,
    "April": 30,
    "May": 31,
    "June": 30,
    "July": 31,
    "August": 31,
    "September": 30,
    "October": 31,
    "November": 30,
    "December": 31
  };

final List<Widget> months = MONTHS.keys
  .map((month) => Padding(
        padding: EdgeInsets.all(12.0),
        child: Text(
          month,
          textScaleFactor: 1.3,
          textAlign: TextAlign.center,
        ),
      ))
  .toList();

and _changeMonths will show the selection result somewhere in the widget tree:

void _changeMonths(int value) {
    setState(() {
      selectedMonth = MONTHS.keys.toList()[value];
    });
}

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。