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

extended_list 封面
套件詳情v3.0.2

extended_list

擴展列表支援追蹤收集垃圾/視口索引,將 lastChild 當作特殊子項建構,並允許佈局接近尾端。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
4740
喜歡數
27
Pub 分數
150

安裝套件

flutter pub add extended_list

套件介紹

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

ExtendedList 是一個 Flutter 套件,透過新增進階功能(如集合追蹤與垃圾回收、視窗索引以及可自訂的最後一個子項目佈局)來增強標準清單元件。它讓開發者能精確控制清單的尾端邊緣,進而於接近尾端邊緣時建構佈局,同時提升效能與彈性。非常適合需要對項目呈現與定位進行細緻控制的複雜捲動情境。

適用情境

  • 自定滾動行為
  • 性能優化的長列表
  • 尾對齊的自定義小部件
  • 複雜列表佈局
  • 動態內容插入
  • 視口感知的使用者介面

主要特色

  • 跟蹤視口和垃圾回收
  • 支援特殊的 lastChild 配置
  • 啟用尾端邊緣佈局精確度
  • 針對大型數據集進行了優化
  • 靈活的項目構建
  • 即時索引追蹤

適合對象

  • 需要高級列表控制項的開發人員
  • 動態或無限列表的應用程式
  • 高性能滾動介面
  • 可自訂的列表UI
  • 列表中的複雜數據可視化

使用建議

  • 需要理解滾動機制
  • 可能增加簡單列表的複雜性
  • 需要仔細處理 lastChild 邏輯
  • 不太適合基本的列表使用情境
  • 重度自定義可能帶來的記憶體開銷

原始 README

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

extended_list

pub package GitHub stars GitHub forks GitHub license GitHub issues FlutterCandies QQ 群

Language: English | 中文简体

extended list(ListView/GridView) support track collect garbage of children/viewport indexes, build lastChild as special child in the case that it is loadmore/no more item and enable to layout close to trailing.

Web demo for ExtendedList

Use

  • add library to your pubspec.yaml

dependencies:
  extended_list: any

  • import library in dart file

  import 'package:extended_list/extended_list.dart';

CollectGarbage

track the indexes are collect, you can collect garbage at that monment(for example Image cache)

more detail

        ExtendedListView.builder(
            extendedListDelegate: ExtendedListDelegate(
                collectGarbage: (List<int> garbages) {
                print("collect garbage : $garbages");
                },),

ViewportBuilder

track the indexes go into the viewport, it's not include cache extent.

        ExtendedListView.builder(
            extendedListDelegate: ExtendedListDelegate(
                viewportBuilder: (int firstIndex, int lastIndex) {
                print("viewport : [$firstIndex,$lastIndex]");
                }),

LastChildLayoutTypeBuilder

build lastChild as special child in the case that it is loadmore/no more item.

img

img

        enum LastChildLayoutType {
        /// as default child
        none,

        /// follow max child trailing layout offset and layout with full cross axis extent
        /// last child as loadmore item/no more item in [ExtendedGridView] and [WaterfallFlow]
        /// with full cross axis extend
        fullCrossAxisExtent,

        /// as foot at trailing and layout with full cross axis extend
        /// show no more item at trailing when children are not full of viewport
        /// if children is full of viewport, it's the same as fullCrossAxisExtent
        foot,
        }

      ExtendedListView.builder(
        extendedListDelegate: ExtendedListDelegate(
            lastChildLayoutTypeBuilder: (index) => index == length
                ? LastChildLayoutType.foot
                : LastChildLayoutType.none,
            ),

CloseToTrailing

when reverse property of List is true, layout is as following. it likes chat list, and new session will insert to zero index. but it's not right when items are not full of viewport.

     trailing
-----------------
|               |
|               |
|     item2     |
|     item1     |
|     item0     |
-----------------
     leading

to solve it, you could set closeToTrailing to true, layout is as following. support [ExtendedGridView],[ExtendedList],[WaterfallFlow]. and it also works when reverse is flase, layout will close to trailing.

     trailing
-----------------
|     item2     |
|     item1     |
|     item0     |
|               |
|               |
-----------------
     leading
      ExtendedListView.builder(
        reverse: true,
        extendedListDelegate: ExtendedListDelegate(closeToTrailing: true),

所屬分類

依賴

依賴清單 1 項

  • extended_list_library^3.0.0

原始碼儲存庫

使用此套件的專案