RollerList constructor

const RollerList(
  1. {List<Widget>? items,
  2. IndexedWidgetBuilder? builder,
  3. int? length,
  4. ValueChanged<int>? onSelectedIndexChanged,
  5. int? initialIndex,
  6. double visibilityRadius = 1.0,
  7. double? width,
  8. double? height,
  9. Color dividerColor = Colors.black,
  10. double dividerThickness = 1.0,
  11. bool enabled = true,
  12. ScrollType scrollType = ScrollType.bothDirections,
  13. Key? key,
  14. VoidCallback? onScrollStarted}
)

You should provide either items list or builder function and length. Priority is given to builder function. It is better to provide width and height. If these parameters are omitted, widget will try to calculate based on the initialIndex item size, but if one parameter is set it would not be overwritten. visibilityRadius means how many widgets are visible on each side of the selected widget. key can be used to set selected item programmatically via Global key. If enabled, user can scroll it, otherwise scrolling can be done only programmatically. onSelectedIndexChanged is called when scrolling is finished. builder function will get index with infinity range, so to get roller scroll effect it is required to use index %

Implementation

const RollerList({
  this.items,
  this.builder,
  this.length,
  this.onSelectedIndexChanged,
  this.initialIndex,
  this.visibilityRadius = 1.0,
  this.width,
  this.height,
  this.dividerColor = Colors.black,
  this.dividerThickness = 1.0,
  this.enabled = true,
  this.scrollType = ScrollType.bothDirections,
  Key? key,
  this.onScrollStarted,
})  : assert(items != null || (builder != null && length != null)),
      super(key: key);