Skip to content
pubscout

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.

WASM-ready
$ flutter pub add positioned_scroll_observer
Source repository

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.