fix(ListViewObserver): support SliverPrototypeExtentList - #159
Merged
LinXunFeng merged 3 commits intoSep 13, 2026
Merged
Conversation
LinXunFeng
deleted the
LinXunFeng/feature-request-support-for-reorderablelistview
branch
September 13, 2026 16:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
Description
ReorderableListViewis aCustomScrollViewwith aSliverReorderableListinside, which builds one of the following slivers depending on its parameters:RenderSliverListitemExtentRenderSliverFixedExtentListitemExtentBuilderRenderSliverVariedExtentListprototypeItem_RenderSliverPrototypeExtentListSo
ListViewObserveralready works withReorderableListView, except whenprototypeItemis used. The same applies toListView(prototypeItem:).Root cause.
ListViewObserver.isSupportRenderSliverTypeonly acceptsRenderSliverList,RenderSliverFixedExtentList, andRenderSliverVariedExtentList(matched by itsruntimeTypestring). The private_RenderSliverPrototypeExtentListis none of them, so the sliver context is never found, and both observation andjumpTo/animateTosilently do nothing.Fix. Check the public abstract base class
RenderSliverFixedExtentBoxAdaptorinstead, which all three fixed-extent slivers extend:This also removes the
runtimeType.toString()comparison, which may not match under--obfuscatesince class names are obfuscated.Compatibility
RenderSliverFixedExtentBoxAdaptoralready exists in Flutter 3.7.0 (the minimum supported version), and_RenderSliverPrototypeExtentListextends it there.RenderSliverVariedExtentListextends it since it was added in 3.16.0. Verified against the 3.7.0 and 3.16.0 sources.onObserveAll, and may become the first sliver used byonObserveandjumpTowithoutsliverContext.SliverViewObserver.extendedHandleObserveis no longer called for them, because the built-in list handling takes over.customTargetRenderSliverType,sliverListContexts, andcustomHandleObservestill take precedence.Example
Add
ListView - Reorderabledemo: drag to reorder, then jump to the item whose value is 50 viaitems.indexOf. A switch in the app bar togglesprototypeItem, and callsobserverController.reattach()because the sliver type changes.Tests
Scroll to index>Fixed height with prototypeItem(ListView)Scroll to index>ReorderableListView>Dynamic heightScroll to index>ReorderableListView>Fixed height with prototypeItemBoth
prototypeItemcases fail without the fix.flutter test- 86 passedflutter analyze- no issues inlib/,test/andexample/dart format --set-exit-if-changed lib/ test/ReorderableListViewapp depending on this branch with Flutter 3.7.0 on the same simulator