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

stacked_listview 封面
套件詳情v1.0.4

stacked_listview

一個堆疊子項的 ListView。當滾動時,每個子項將首先被堆疊。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
1640
喜歡數
52
Pub 分數
150

安裝套件

flutter pub add stacked_listview

套件介紹

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

StackedListView 是一個 Flutter 小部件,會將子項目堆疊在一起顯示,第一個項目完全可見,後續項目在使用者捲動時部分重疊。它創造出一種視覺上吸引人的效果,讓項目看起來彼此堆疊,非常適合建立動態、分層的列表介面。此套件支援所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,使其在跨平台應用中極具多功能性。專為尋求獨特列表動畫但不需要複雜自定繪製的開發者設計。

適用情境

  • 建立分層可捲動清單
  • 設計具有深度的基於卡片的使用者介面
  • 建構視覺豐富的資訊流佈局
  • 實現互動式堆疊項目過渡
  • 透過視覺提示增強移動應用導航

主要特色

  • 堆疊子項渲染
  • 具有層疊效果的平滑捲動
  • 跨平台相容性
  • 透過 pub 簡單整合
  • 可自訂的堆疊行為
  • 內建動畫支援

適合對象

  • 尋求視覺深度的UI設計師
  • 開發現代應用程式介面的開發者
  • 具有卡片或時間軸樣式內容的應用
  • 需要微妙動畫列表效果的項目
  • Flutter 初學者探索進階列表模式

使用建議

  • 包含大量項目時可能影響效能
  • 需要仔細的佈局規劃
  • 最適合中等數量的項目
  • 超出堆疊之外的自訂功能有限
  • 不適合密集資料清單
  • 需要在低階設備上進行測試

原始 README

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

A Stacked ListView

Video

v1.0.4 Breaking Change

  • onRemove(int index) changed to onRemove(int index, AxisDirection dir)
  • beforeRemove(int index) changed to beforeRemove(int index, AxisDirection dir)
🎉🎉 Yes, Now you can know the user's swipe direction for each list item 🎉🎉

Install

flutter pub add stacked_listview

Example code:

Scaffold(
  appBar: AppBar(),
  backgroundColor: Colors.black,
  body: SafeArea(
    child: StackedListView(
      padding: EdgeInsets.only(left: 20, right: 20, top: 50),
      itemCount: data.length,
      itemExtent: itemHeight,
      heightFactor: 0.7,
      fadeOutFrom: 0.7,
      onRemove: (index, direction) {
        setState(() {
          data.removeAt(index);
        });
      },
      beforeRemove: (index, direction) async {
        return await showDialog<bool>(
          context: context,
          builder: (_) => AlertDialog(
            title: Text('Delete ${data[index]} ?'),
            actions: [
              TextButton(
                  onPressed: () => Navigator.pop(context),
                  child: Text('Cancel')),
              ElevatedButton(
                onPressed: () => Navigator.pop(context, true),
                child: Text('Delete'),
              ),
            ],
          ),
        ).then((value) => value == true);
      },
      builder: (_, index) {
        return Container(
          width: double.infinity,
          height: itemHeight,
          decoration: BoxDecoration(
            borderRadius: BorderRadius.all(Radius.circular(20.0)),
            color: Colors.white,
            boxShadow: [
              BoxShadow(color: Colors.black.withAlpha(100), blurRadius: 10),
            ],
          ),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                data[index],
                style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
              ),
              Text('Slide to left or right to delete'),
            ],
          ),
          padding: EdgeInsets.all(20),
        );
      },
    ),
  ),
);

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。