scrollview_observer
1.27.3, released 2 months ago by fullstackaction.com
Observe visible child widgets and scroll to specific indices in ScrollViews.
WASM-readyRock solid
What it does
Observes child elements currently displayed within Flutter scrollable widgets without modifying their structure. It provides controllers to track visible indices, scroll precisely to specified items, and handle scroll positioning challenges such as chat message list jumping.
AI-written summary of version 1.27.3, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to know which child items are currently visible in a ListView, GridView, or PageView
- You need to scroll directly to a specific child widget by index
- You are implementing chat session views and need to maintain scroll position during message updates
Skip it when
- You only need simple, fixed-offset scrolling natively provided by ScrollController
- Your scroll view has a very small, fixed set of widgets where manual keys and Scrollable.ensureVisible suffice
Strengths
- Supports multiple scroll widgets including ListView, GridView, PageView, SliverList, and NestedScrollView
- Non-invasive integration by wrapping existing scrollable widgets in observer widgets
- Includes dedicated chat scrolling helpers to prevent viewport jitter when inserting items
Weaknesses
- Detailed implementation examples and API usage require consulting external wiki or article links
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
None
ListViewObserver(
child: ListView.builder(
itemCount: 100,
itemBuilder: (ctx, index) => ListTile(title: Text('Item $index')),
),
onObserve: (resultModel) {
print('Displaying indices: ${resultModel.displayingChildIndexList}');
},
)Works with
Packages commonly used together with scrollview_observer: ones it builds on, ones built on it, and its own family.
- flutter_chat_uiBuilt on scrollview_observerA customizable, cross‑platform chat UI widget set for Flutter.
- flutter_iconpickerBuilt on scrollview_observerA dialog to pick single or multiple icons with search and customizable icon packs.
- inappstory_pluginBuilt on scrollview_observerA Flutter plugin to use InAppStory SDK. Supports Android and iOS platforms.
- cometchat_chat_uikitBuilt on scrollview_observerPrebuilt UI components for text chat, media messaging, and voice/video calls.