controller property

ScrollController? controller
final

Typically a FixedExtentScrollController used to control the current item.

A FixedExtentScrollController can be used to read the currently selected/centered child item and can be used to change the current item.

If none is provided, a new FixedExtentScrollController is implicitly created.

If a ScrollController is used instead of FixedExtentScrollController, ScrollNotification.metrics will no longer provide FixedExtentMetrics to indicate the current item index and onSelectedItemChanged will not work.

To read the current selected item only when the value changes, use onSelectedItemChanged.

Implementation

final ScrollController? controller;