v3.0.2extended_list
擴展列表支援追蹤收集垃圾/視口索引,將 lastChild 當作特殊子項建構,並允許佈局接近尾端。
擴展列表(ListView/GridView)支援追蹤收集子項/視口索引的垃圾,當最後一個子項為載入更多/無更多項目時,將其作為特殊子項處理,並允許其佈局接近尾端。
以下為英文專案原文快照,最新內容請造訪 GitHub。
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.
dependencies:
extended_list: any
import 'package:extended_list/extended_list.dart';
track the indexes are collect, you can collect garbage at that monment(for example Image cache)
ExtendedListView.builder(
extendedListDelegate: ExtendedListDelegate(
collectGarbage: (List<int> garbages) {
print("collect garbage : $garbages");
},),
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]");
}),
build lastChild as special child in the case that it is loadmore/no more item.
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,
),
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),
依賴清單 3 項
^3.0.0{"sdk":"flutter"}{"sdk":"flutter"}先依使用情境篩選,再比較專案活躍情況,最後到原始儲存庫確認使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗