{"id":19273027,"url":"https://github.com/fluttercandies/extended_list","last_synced_at":"2025-06-30T00:32:27.489Z","repository":{"id":56828592,"uuid":"223220514","full_name":"fluttercandies/extended_list","owner":"fluttercandies","description":"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.","archived":false,"fork":false,"pushed_at":"2025-04-20T12:27:34.000Z","size":2440,"stargazers_count":52,"open_issues_count":4,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T13:35:50.534Z","etag":null,"topics":["extended-list","flutter"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fluttercandies.png","metadata":{"files":{"readme":"README-ZH.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":"http://zmtzawqlp.gitee.io/my_images/images/qrcode.png"}},"created_at":"2019-11-21T16:46:50.000Z","updated_at":"2025-04-20T12:27:37.000Z","dependencies_parsed_at":"2023-11-21T07:54:49.668Z","dependency_job_id":"be77ce3b-e0b8-4263-b247-1c60216eb102","html_url":"https://github.com/fluttercandies/extended_list","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fluttercandies/extended_list","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fextended_list","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fextended_list/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fextended_list/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fextended_list/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluttercandies","download_url":"https://codeload.github.com/fluttercandies/extended_list/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fextended_list/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262689553,"owners_count":23349133,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["extended-list","flutter"],"created_at":"2024-11-09T20:40:09.416Z","updated_at":"2025-06-30T00:32:26.839Z","avatar_url":"https://github.com/fluttercandies.png","language":"Dart","funding_links":["http://zmtzawqlp.gitee.io/my_images/images/qrcode.png"],"categories":[],"sub_categories":[],"readme":"# extended_list\n\n[![pub package](https://img.shields.io/pub/v/extended_list.svg)](https://pub.dartlang.org/packages/extended_list) [![GitHub stars](https://img.shields.io/github/stars/fluttercandies/extended_list)](https://github.com/fluttercandies/extended_list/stargazers) [![GitHub forks](https://img.shields.io/github/forks/fluttercandies/extended_list)](https://github.com/fluttercandies/extended_list/network) [![GitHub license](https://img.shields.io/github/license/fluttercandies/extended_list)](https://github.com/fluttercandies/extended_list/blob/master/LICENSE) [![GitHub issues](https://img.shields.io/github/issues/fluttercandies/extended_list)](https://github.com/fluttercandies/extended_list/issues) \u003ca href=\"https://qm.qq.com/q/ZyJbSVjfSU\"\u003e![FlutterCandies QQ 群](https://img.shields.io/badge/dynamic/yaml?url=https%3A%2F%2Fraw.githubusercontent.com%2Ffluttercandies%2F.github%2Frefs%2Fheads%2Fmain%2Fdata.yml\u0026query=%24.qq_group_number\u0026label=QQ%E7%BE%A4\u0026logo=qq\u0026color=1DACE8)\n\nLanguage: [English](README.md) | 中文简体\n\n扩展(ListView/GridView) 支持追踪列表元素回收/Viewport 的 index 改变,最后一个元素为 loadmore/no more 元素时候的特殊布局,以及针对 reverse 为 true 时候布局靠近底部的布局。\n\n[Web demo for ExtendedList](https://fluttercandies.github.io/extended_list/)\n\n- [extended_list](#extended_list)\n  - [使用](#使用)\n  - [列表元素回收](#列表元素回收)\n  - [ViewportBuilder](#viewportbuilder)\n  - [LastChildLayoutTypeBuilder](#lastchildlayouttypebuilder)\n  - [CloseToTrailing](#closetotrailing)\n\n## 使用\n\n- 在 pubspec.yaml 中增加库引用\n\n```yaml\ndependencies:\n  extended_list: any\n```\n\n- 导入库\n\n```dart\n\n  import 'package:extended_list/extended_list.dart';\n\n```\n\n## 列表元素回收\n\n追踪列表元素回收，你可以在这个时刻回收一些内存，比如图片的内存缓存。\n\n[更多详情](https://github.com/fluttercandies/extended_image/blob/e1577bc4d0b57c725110a9d886703b98a72772b5/example/lib/pages/photo_view_demo.dart#L91)\n\n```dart\n        ExtendedListView.builder(\n            extendedListDelegate: ExtendedListDelegate(\n                collectGarbage: (List\u003cint\u003e garbages) {\n                print(\"collect garbage : $garbages\");\n                },),\n```\n\n## ViewportBuilder\n\n追踪进入 Viewport 的列表元素的 index（即你看到的可视区域，并不包括缓存距离）\n\n```dart\n        ExtendedListView.builder(\n            extendedListDelegate: ExtendedListDelegate(\n                viewportBuilder: (int firstIndex, int lastIndex) {\n                print(\"viewport : [$firstIndex,$lastIndex]\");\n                }),\n```\n\n## LastChildLayoutTypeBuilder\n\n为最后一个元素创建特殊布局，这主要是用在将最后一个元素作为 loadmore/no more 的时候。\n\n![img](https://github.com/fluttercandies/Flutter_Candies/blob/master/gif/extended_list/gridview.gif)\n\n![img](https://github.com/fluttercandies/Flutter_Candies/blob/master/gif/extended_list/listview.gif)\n\n```dart\n        enum LastChildLayoutType {\n        /// 普通的\n        none,\n\n        /// 将最后一个元素绘制在最大主轴Item之后，并且使用横轴大小最为layout size\n        /// 主要使用在[ExtendedGridView] and [WaterfallFlow]中，最后一个元素作为loadmore/no more元素的时候。\n        fullCrossAxisExtent,\n\n        /// 将最后一个child绘制在trailing of viewport，并且使用横轴大小最为layout size\n        /// 这种常用于最后一个元素作为loadmore/no more元素，并且列表元素没有充满整个viewport的时候\n        /// 如果列表元素充满viewport，那么效果跟fullCrossAxisExtent一样\n        foot,\n        }\n\n      ExtendedListView.builder(\n        extendedListDelegate: ExtendedListDelegate(\n            lastChildLayoutTypeBuilder: (index) =\u003e index == length\n                ? LastChildLayoutType.foot\n                : LastChildLayoutType.none,\n            ),\n```\n\n## CloseToTrailing\n\n当 reverse 设置为 true 的时候，布局会变成如下。常用于聊天列表，新的会话会被插入 0 的位置，但是当会话没有充满 viewport 的时候，下面的布局不是我们想要的。\n\n```\n     trailing\n-----------------\n|               |\n|               |\n|     item2     |\n|     item1     |\n|     item0     |\n-----------------\n     leading\n```\n\n为了解决这个问题，你可以设置 closeToTrailing 为 true, 布局将变成如下\n该属性同时支持[ExtendedGridView],[ExtendedList],[WaterfallFlow]。\n当然如果 reverse 如果不为 ture，你设置这个属性依然会生效，没满 viewport 的时候布局会紧靠 trailing\n\n```\n     trailing\n-----------------\n|     item2     |\n|     item1     |\n|     item0     |\n|               |\n|               |\n-----------------\n     leading\n```\n\n```dart\n      ExtendedListView.builder(\n        reverse: true,\n        extendedListDelegate: ExtendedListDelegate(closeToTrailing: true),\n```\n## ☕️Buy me a coffee\n\n![img](http://zmtzawqlp.gitee.io/my_images/images/qrcode.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercandies%2Fextended_list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluttercandies%2Fextended_list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercandies%2Fextended_list/lists"}