搜索插件、代码仓与 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 中的无限滚动。它提供了一种简洁、可重复使用的分页和懒加载解决方案,无需复杂的自定义逻辑。该包可无缝集成到现有的可滚动控件中,并支持移动、Web 和桌面等多个平台。对于显示长列表数据的应用(如信息流、产品目录或聊天记录)非常理想。通过最少的设置,开发者可以动态加载内容,从而提升用户体验。

适合场景

  • 无限滚动信息流
  • 产品列表页面
  • 聊天消息加载中
  • 动态数据网格
  • 用户个人资料时间线

主要特点

  • 自动底部检测
  • 与 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.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。