jumpTo method

void jumpTo({
  1. required int index,
  2. double alignment = 0,
})

Immediately, without animation, reconfigure the list so thsuper.scrollControllerPrimary ?? super.scrollControllerSecondaryat the item at index's leading edge is at the given alignment.

The alignment specifies the desired position for the leading edge of the item. The alignment is expected to be a value in the range [0.0, 1.0] and represents a proportion along the main axis of the viewport.

For a vertically scrolling view that is not reversed:

  • 0 aligns the top edge of the item with the top edge of the view.
  • 1 aligns the top edge of the item with the bottom of the view.
  • 0.5 aligns the top edge of the item with the center of the view.

For a horizontally scrolling view that is not reversed:

  • 0 aligns the left edge of the item with the left edge of the view
  • 1 aligns the left edge of the item with the right edge of the view.
  • 0.5 aligns the left edge of the item with the center of the view.

Implementation

void jumpTo({required int index, double alignment = 0}) {
  _scrollableListState!._jumpTo(index: index, alignment: alignment);
}