Skip to content
pubscout

scroll_pos

0.5.0, released 3 years ago by winxaito.com

Adds helper methods to ScrollController for navigating items by index or position.

WASM-readySingle maintainer
$ flutter pub add scroll_pos
Source repository

What it does

Provides a controller that can scroll to a specific item, to the start or end, and move forward or backward by page. It also exposes flags to check if scrolling is possible and whether the list is at the start or end.

AI-written summary of version 0.5.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to programmatically jump to a specific item in a list with uniform item height.
  • You want simple forward/backward or page navigation without writing custom logic.
  • You need to know if the list is already at the top or bottom to disable buttons or show indicators.

Skip it when

  • Your list items have varying heights, as the package assumes equal height for accurate calculations.
  • You prefer a declarative navigation approach using packages like page_transition or smooth_page_indicator for page-based scrolling.

Strengths

  • Simple API, no extra dependencies.
  • Supports both vertical and horizontal scrolling.
  • Provides flags (canScroll, canForward, canBackward, atStart, atEnd) for UI state.
  • Allows animated or instant scrolling.

Weaknesses

  • Assumes all items have the same height; otherwise calculations are wrong.
  • No built‑in support for dynamic item sizes or complex layouts.
  • Limited to scrolling logic; no visual widgets or theming.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0

Add dependency in pubspec and import the package. No build_runner or permissions required.

final controller = ScrollPosController(itemCount: 20);
ListView(controller: controller, children: [...]);
TextButton(onPressed: () => controller.scrollToItem(5, animate: true), child: Text('Go to 5'))

Alternatives

Packages that do the same job and could replace scroll_pos.

Works with

Packages commonly used together with scroll_pos: ones it builds on, ones built on it, and its own family.