搜索插件、代码仓与 APP 分类

插件详情v2.0.2

infinite_widgets

无限布局小部件,可让您轻松从数据库或网络调用创建无限列表或无限网格。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
584
喜欢数
19
Pub 分数
140

安装插件

flutter pub add infinite_widgets

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

InfiniteWidgets 是一个 Flutter 包,可简化无限滚动列表和网格的创建,非常适合从数据库或网络源逐步加载数据。它提供了处理分页逻辑的布局小部件,无缝减少样板代码。专为性能设计,可按需高效加载项目,非常适合大型数据集。该包支持所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。

适合场景

  • 从API加载大型数据集
  • 创建无限滚动的动态信息流
  • 使用延迟加载构建动态网格
  • 在应用程序中实现分页内容
  • 显示实时数据流

主要特点

  • 高效的惰性加载
  • 对无限列表和网格的支持
  • 内置分页处理
  • 跨平台兼容性
  • 最少的样板代码
  • 流畅的用户体验

适合对象

  • 包含大量数据集的应用程序
  • 社交媒体动态
  • 电子商务商品列表
  • 实时数据展示
  • 寻求简单分页的开发者

使用建议

  • 需要正确的状态管理
  • 可能需要自定义错误处理
  • 最适合连续数据流
  • 不适合小型静态列表
  • 性能取决于数据源的效率

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

infinite_widgets

Infinite layout widgets like lists, grids...

Infinite list

InfiniteListView has same attributes as a normal flutter ListView widget.

InfiniteListView.separated(
        itemBuilder: (context, index) {
          return Text('$index', style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold));
        },
        itemCount: _data.length, // Current itemCount you have
        hasNext: _data.length < 200, // let the widget know if you have more data to show or not
        nextData: this.loadNextData, // callback called when end to the list is reach and hasNext is true
        separatorBuilder: (context, index) => Divider(height: 1),
      ),
    );

You can specify the last loading row by providing loadingWidget.

You can interact with the trigger to load additional data by default it's 300 but you can override it with scrollThreshold.

Infinite grid

InfiniteGridView has same attributes as a normal flutter GridView widget.

InfiniteGridView(
        gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4),
        itemBuilder: (context, index) {
          return Text('$index', style: TextStyle(color: Colors.white));
        },
        itemCount: _data.length, // Current itemCount you have
        hasNext: _data.length < 200, // let the widget know if you have more data to show or not
        nextData: this.loadNextData, // callback called when end to the list is reach and hasNext is true
      ),
    );

You can specify the last loading row by providing loadingWidget.

You can interact with the trigger to load additional data by default it's 300 but you can override it with scrollThreshold.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。