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

load_items 封面
套件詳情v0.6.0

load_items

在 ListView 或 GridView 滾動到底部時載入更多項目。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
22
喜歡數
6
Pub 分數
150

安裝套件

flutter pub add load_items

套件介紹

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

load_items 套件透過在使用者滾動至 ListView 或 GridView 底部時自動載入更多項目,簡化了 Flutter 中的無限捲動。它提供一種乾淨、可重複使用的分頁與懶加載解決方案,無需複雜的自訂邏輯。該套件可順暢整合至現有的可捲動組件,並支援多個平台,包括行動裝置、網頁和桌面。對於顯示長清單資料的應用程式(例如資訊流、產品目錄或聊天記錄)非常理想。只需少量設定,開發者即可透過使用者滾動動態載入內容,提升使用者體驗。

適用情境

  • 無限滾動資訊流
  • 產品列表頁面
  • 聊天訊息加載中
  • 動態數據網格
  • 使用者個人檔案時間線

主要特色

  • 自動底部檢測
  • 與 ListView/GridView 的簡單整合
  • 跨平台支援
  • 可設定的載入閾值
  • 內建的載入狀態管理

適合對象

  • 開發可滾動清單的開發者
  • 動態內容的應用程式
  • 分頁密集型 UI
  • 行動與Web應用程式
  • 需要延遲加載的專案

使用建議

  • 需要正確處理非同步資料擷取
  • 可能需要自定義錯誤狀態
  • 不適用於定長列表
  • 取決於滾動位置的準確性
  • 最佳搭配狀態管理解決方案

原始 README

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

load_items

Load new items into either a list or a grid as you scroll down.

screencast

Features

  • load new items when scrolling to the bottom of a ListView or GridView
  • pagination support by passing the previous items to ItemsLoader
  • add custom widget builders for items, loaders and empty widgets
  • configurable ListView and GridView
  • configure when to load more via loadScrollFactor
  • pull-to-refresh to reload data
  • force refresh using a Listenable
  • scroll to top using a Listenable
  • fade out bottom if more option

Example

LoadItems<Item>(
	type: LoadItemsType.grid,
	itemBuilder: (context, Item item, int index) {
		return ListTile(title: item.title);
	},
	itemsLoader: (List<Item> currentItems) {
		return await Api.fetch({skip: currentItems.length});
	},
	gridCrossAxisCount: 3,
)

See example for full list and grid example.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。