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

extended_list 封面
插件详情v3.0.2

extended_list

扩展列表支持跟踪收集垃圾/视口索引,将 lastChild 作为特殊子项构建,并允许布局接近尾部。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
4160
喜欢数
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

源码仓库

使用此插件的项目