anchor_scroll_controller
0.4.4, released 3 years ago by an unverified publisher
ScrollController that supports scrolling to an index and listening to index changes.
What it does
Provides a custom ScrollController implementation that allows scrolling a list view directly to a specific item index. It also exposes callbacks and listeners to detect when the current visible index changes during scrolling.
AI-written summary of version 0.4.4, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to programmatically scroll a ListView or ScrollView to a specific item index.
- You need to track which item index is currently visible or active during user scrolling.
Skip it when
- You are using a non-scrollable UI layout.
- You do not need index tracking or scroll-to-index capabilities.
Strengths
- Supports scrolling to a specific index easily.
- Allows listening to index changes both programmatically and via user scroll.
- Supports fixed item sizes as well as variable item sizes via wrappers.
Weaknesses
- Requires wrapping list items with specific widgets (AnchorItemWrapper) unless using fixed sizes.
- Adds extra overhead to standard list management.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
Not documented
late final AnchorScrollController _scrollController;
@override
void initState() {
super.initState();
_scrollController = AnchorScrollController(
onIndexChanged: (index) {
print('Current index: $index');
},
);
}
@override
Widget build(BuildContext context) {
return ListView.builder(
controller: _scrollController,
itemCount: 10,
itemBuilder: (context, index) => AnchorItemWrapper(
index: index,
controller: _scrollController,
child: Text('Item $index'),
),
);
}Alternatives
Packages that do the same job and could replace anchor_scroll_controller.
- two_dimensional_scrollables
Widgets for two‑dimensional scrolling like TableView and TreeView
94Compare - marqueer
A customizable Flutter marquee widget for smooth multi-direction scrolling content.
81Compare - flutter_in_app_pip
Provides in-app Picture-in-Picture support with customizable widget
54Compare - infinite_grouped_list
Dynamic scrolling list that efficiently groups items and loads more data as the user scrolls.
79Compare