positioned_scroll_observer
2.2.3, released 10 months ago by simonwang.dev
Scroll observer to jump or animate to indices in scroll views without breaking current widgets.
What it does
Allows you to scroll to specific indices or ratios in ListView, GridView, CustomScrollView, and SingleChildScrollView. It also provides visibility checking for items and scroll offset retention physics.
AI-written summary of version 2.2.3, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to programmatically jump or animate to a specific index in a list or grid.
- You want to check if a specific item index is currently visible on screen.
- You need to retain scroll position when adding items to the top of a list.
Skip it when
- You are using NestedScrollView, which is not yet supported.
- You are not willing to wrap item widgets inside an ObserverProxy.
Strengths
- Supports a wide range of scroll views including ListView, GridView, CustomScrollView, SingleChildScrollView, and ListWheelScrollView.
- Provides utilities for checking visible items and visibility ratios.
- Includes PositionRetainedScrollPhysics for retaining scroll offsets.
Weaknesses
- Requires every observed item widget or builder to be wrapped using ObserverProxy.
- NestedScrollView is currently untested and not supported.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
not documented
final _observer = ScrollObserver.sliverMulti(itemCount: 30);
ListView.builder(
controller: _controller,
itemBuilder: (context, index) => ObserverProxy(
observer: _observer,
child: ListTile(title: Text("Item $index")),
),
itemCount: 30,
);Alternatives
Packages that do the same job and could replace positioned_scroll_observer.
- indexed_list_view
Infinite ListView that lets you programmatically jump instantly to any item by index.
82Compare - reorderable_grid_view
A reorderable grid view widget for Flutter supporting drag-and-drop reordering.
50Compare - infinite_scroll_tab_view
A Flutter package for tab view component that can scroll infinitely.
42Compare - marquee_widget
A Flutter widget that scrolls text and other widgets with RTL support.
47Compare