Carousel constructor

const Carousel({
  1. Key? key,
  2. required Widget itemBuilder(
    1. BuildContext context,
    2. int index
    ),
  3. int? itemCount,
  4. CarouselController? controller,
  5. CarouselAlignment alignment = CarouselAlignment.center,
  6. Axis direction = Axis.horizontal,
  7. bool wrap = true,
  8. bool pauseOnHover = true,
  9. Duration? autoplaySpeed,
  10. bool waitOnStart = false,
  11. bool draggable = true,
  12. bool reverse = false,
  13. bool autoplayReverse = false,
  14. CarouselSizeConstraint sizeConstraint = const CarouselFractionalConstraint(1),
  15. Duration speed = const Duration(milliseconds: 200),
  16. Curve curve = Curves.easeInOut,
  17. Duration? duration,
  18. Duration? durationBuilder(
    1. int index
    )?,
  19. ValueChanged<int>? onIndexChanged,
  20. bool disableOverheadScrolling = true,
  21. bool disableDraggingVelocity = false,
  22. required CarouselTransition transition,
})

Creates a carousel.

Implementation

const Carousel({
  super.key,
  required this.itemBuilder,
  this.itemCount,
  this.controller,
  this.alignment = CarouselAlignment.center,
  this.direction = Axis.horizontal,
  this.wrap = true,
  this.pauseOnHover = true,
  this.autoplaySpeed,
  this.waitOnStart = false,
  this.draggable = true,
  this.reverse = false,
  this.autoplayReverse = false,
  this.sizeConstraint = const CarouselFractionalConstraint(1),
  this.speed = const Duration(milliseconds: 200),
  this.curve = Curves.easeInOut,
  this.duration,
  this.durationBuilder,
  this.onIndexChanged,
  this.disableOverheadScrolling = true,
  this.disableDraggingVelocity = false,
  required this.transition,
}) : assert(wrap || itemCount != null,
          'itemCount must be provided if wrap is false');