scroll_to_index
3.0.1, released 5 years ago by quire.io
Scroll to a specific child of any scrollable widget in Flutter.
What it does
Provides a mechanism to scroll to a specific index inside any Flutter scrollable widget using an AutoScrollController and AutoScrollTag. Supports both fixed and variable row heights.
AI-written summary of version 3.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to programmatically scroll a ListView or other scrollable widget to a specific item index.
- You want to highlight children when they are scrolled into view.
Skip it when
- You do not need to target specific child indices programmatically in your scroll views.
Strengths
- Works with any Flutter scrollable widget.
- Supports both fixed and variable row heights.
- Provides optional highlighting capabilities for targeted items.
Weaknesses
- Requires wrapping children in AutoScrollTag widgets and using a custom controller.
- Variable row height scrolling relies on estimation and search mechanisms.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
final controller = AutoScrollController();
ListView(
controller: controller,
children: List.generate(100, (index) => AutoScrollTag(
key: ValueKey(index),
controller: controller,
index: index,
child: Text('Item $index'),
)),
);Alternatives
Packages that do the same job and could replace scroll_to_index.
- two_dimensional_scrollables
Widgets for two‑dimensional scrolling like TableView and TreeView
94Compare - carousel_slider
Carousel slider widget with infinite scroll, auto play, and custom child support
73Compare - carousel_slider_plus
A customizable carousel slider widget with infinite scroll and autoplay support.
72Compare - scroll_spy
Detect visible items and select one stable primary item in Flutter scrollables.
67Compare
Works with
Packages commonly used together with scroll_to_index: ones it builds on, ones built on it, and its own family.
- animated_tree_viewBuilt on scroll_to_indexA hierarchical tree view widget with animations, based on AnimatedList.
- accordionBuilt on scroll_to_indexAn expandable and collapsible accordion list widget for Flutter.
- markdown_widgetBuilt on scroll_to_indexA simple and easy-to-use markdown rendering component for Flutter.
- vertical_scrollable_tabviewBuilt on scroll_to_indexA Flutter widget that synchronizes a ScrollView and a custom tab view.
- toggle_listBuilt on scroll_to_indexAn easy-to-use and highly customizable expandable list widget for your Flutter application.