IndexedScrollController constructor
IndexedScrollController({
- ScrollController? scrollController,
- Duration duration = const Duration(milliseconds: 500),
- Curve curve = Curves.easeOut,
- double alignment = 0.2,
- ScrollPositionAlignmentPolicy alignmentPolicy = ScrollPositionAlignmentPolicy.keepVisibleAtStart,
- int endOfFramePasses = 6,
- int maxFramePasses = 12,
Creates an IndexedScrollController.
All parameters are optional and have sensible defaults.
scrollController: The underlying scroll controller. If null, a new one is created.duration: Default animation duration when scrolling to an index (default: 400ms).curve: The animation curve to use for scrolling (default: Curves.easeOut).alignment: The vertical/horizontal alignment of the target item (0.0 to 1.0).- 0.0 aligns the item at the start (top/left)
- 0.5 centers the item
- 1.0 aligns the item at the end (bottom/right) Default is 0.2 (20% from the start).
alignmentPolicy: Determines how the scroll position is adjusted.endOfFramePasses: Number of frame passes to wait at end of scroll (default: 12).maxFramePasses: Maximum number of frames to wait before scrolling (default: 15).
Implementation
IndexedScrollController({
ScrollController? scrollController,
this.duration = const Duration(milliseconds: 500),
this.curve = Curves.easeOut,
this.alignment = 0.2,
this.alignmentPolicy = ScrollPositionAlignmentPolicy.keepVisibleAtStart,
this.endOfFramePasses = 6,
this.maxFramePasses = 12,
}) : _scrollController = scrollController ?? ScrollController();