anchored_list 0.1.1
anchored_list: ^0.1.1 copied to clipboard
Jump to any index in a lazy list in constant time, and hold your place when items arrive above it. One viewport anchored at the target, not two lists cross-fading.
0.1.1 #
Packaging only — no API or behaviour changes.
- The demo animations now ship inside the package, so they appear as screenshots on the pub.dev page rather than only in the README on GitHub.
.pubignoreexcludes the raw recorder frames, so shipping them costs about 440 KB rather than the 11 MB the frame directory would have added.
0.1.0 #
Initial release.
Jumping
AnchoredList.builder— a lazy list that jumps to any index in constant time, by re-anchoring a centre sliver rather than cross-fading two lists.AnchoredListControllerwithjumpToIndex,animateToIndexandanchorIndex.- One viewport and one set of children, so there is no transition artefact and nothing is built twice.
Holding position while the list changes
itemsInsertedAboveanditemsRemovedAbovekeep the viewport pixel-still when items arrive at or leave the top of the list. Because the anchor is an index, the correction is arithmetic on one integer and the scroll offset is never touched — nothing moves on screen, even mid-item.findChildIndexCallbacklocates items by key so their state survives insertions, translated across the two slivers for you.
Reaching the scroll position
scrollControllermay be supplied, andAnchoredListController .scrollControllerreturns whichever one is in use — enough for aScrollbar, page-up/page-down, or linking two lists.- Offsets are measured from the anchor, so zero is the anchored item and content above it is at negative offset.
Reporting
itemPositionsreports each built item's place as a fraction of the viewport, withisVisible,isFullyVisibleandextent.
The rest of the ListView surface
AnchoredList.separatedandAnchoredList(children: [...]).padding,physics,reverse,scrollDirection,cacheExtent,semanticChildCount,dragStartBehavior,keyboardDismissBehavior,scrollBehavior,clipBehavior,restorationIdand the threeadd*flags.paddingis split between the two slivers rather than applied to both, which would double the inset at the anchor.- Semantic indexes are translated, so items above the anchor announce their real list index instead of counting backwards from it.
Not supported: shrinkWrap, and this is not a sliver. Flutter asserts
!shrinkWrap || center == null, so a centre-anchored viewport cannot size to
its content — the parameter is absent rather than present and broken.
