CarouselOptions class

Constructors

CarouselOptions({double? height, double aspectRatio = 16 / 9, double viewportFraction = 0.8, int initialPage = 0, bool enableInfiniteScroll = true, bool animateToClosest = true, bool reverse = false, bool autoPlay = false, Duration autoPlayInterval = const Duration(seconds: 4), Duration autoPlayAnimationDuration = const Duration(milliseconds: 800), Curve autoPlayCurve = Curves.fastOutSlowIn, bool? enlargeCenterPage = false, dynamic onPageChanged(int index, CarouselPageChangedReason reason)?, ValueChanged<double?>? onScrolled, ScrollPhysics? scrollPhysics, bool pageSnapping = true, Axis scrollDirection = Axis.horizontal, bool pauseAutoPlayOnTouch = true, bool pauseAutoPlayOnManualNavigate = true, bool pauseAutoPlayInFiniteScroll = false, PageStorageKey? pageViewKey, CenterPageEnlargeStrategy enlargeStrategy = CenterPageEnlargeStrategy.scale, double enlargeFactor = 0.3, bool disableCenter = false, bool padEnds = true, Clip clipBehavior = Clip.hardEdge})

Properties

animateToClosest bool
Determines if carousel should loop to the closest occurence of requested page.
final
aspectRatio double
Aspect ratio is used if no height have been declared.
final
autoPlay bool
Enables auto play, sliding one page at a time.
final
autoPlayAnimationDuration Duration
The animation duration between two transitioning pages while in auto playback.
final
autoPlayCurve Curve
Determines the animation curve physics.
final
autoPlayInterval Duration
Sets Duration to determent the frequency of slides when
final
clipBehavior Clip
Exposed clipBehavior of PageView
final
disableCenter bool
Whether or not to disable the Center widget for each slide.
final
enableInfiniteScroll bool
Determines if carousel should loop infinitely or be limited to item length.
final
enlargeCenterPage bool?
Determines if current page should be larger than the side images, creating a feeling of depth in the carousel.
final
enlargeFactor double
How much the pages next to the center page will be scaled down. If enlargeCenterPage is false, this property has no effect.
final
enlargeStrategy CenterPageEnlargeStrategy
Use enlargeStrategy to determine which method to enlarge the center page.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
Set carousel height and overrides any existing aspectRatio.
final
initialPage int
The initial page to show when first creating the CarouselSlider.
final
onPageChanged → dynamic Function(int index, CarouselPageChangedReason reason)?
Called whenever the page in the center of the viewport changes.
final
onScrolled ValueChanged<double?>?
Called whenever the carousel is scrolled
final
padEnds bool
Whether to add padding to both ends of the list. If this is set to true and viewportFraction < 1.0, padding will be added such that the first and last child slivers will be in the center of the viewport when scrolled all the way to the start or end, respectively. If viewportFraction >= 1.0, this property has no effect. This property defaults to true and must not be null.
final
pageSnapping bool
Set to false to disable page snapping, useful for custom scroll behavior.
final
pageViewKey PageStorageKey?
Pass a PageStoragekey if you want to keep the pageview's position when it was recreated.
final
pauseAutoPlayInFiniteScroll bool
If enableInfiniteScroll is false, and autoPlay is true, this option decide the carousel should go to the first item when it reach the last item or not. If set to true, the auto play will be paused when it reach the last item. If set to false, the auto play function will animate to the first item when it was in the last item.
final
pauseAutoPlayOnManualNavigate bool
If true, the auto play function will be paused when user is calling pageController's nextPage or previousPage or animateToPage method. And after the animation complete, the auto play will be resumed. Default to true.
final
pauseAutoPlayOnTouch bool
If true, the auto play function will be paused when user is interacting with the carousel, and will be resumed when user finish interacting. Default to true.
final
reverse bool
Reverse the order of items if set to true.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollDirection Axis
The axis along which the page view scrolls.
final
scrollPhysics ScrollPhysics?
How the carousel should respond to user input.
final
viewportFraction double
The fraction of the viewport that each page should occupy.
final

Methods

copyWith({double? height, double? aspectRatio, double? viewportFraction, int? initialPage, bool? enableInfiniteScroll, bool? reverse, bool? autoPlay, Duration? autoPlayInterval, Duration? autoPlayAnimationDuration, Curve? autoPlayCurve, bool? enlargeCenterPage, dynamic onPageChanged(int index, CarouselPageChangedReason reason)?, ValueChanged<double?>? onScrolled, ScrollPhysics? scrollPhysics, bool? pageSnapping, Axis? scrollDirection, bool? pauseAutoPlayOnTouch, bool? pauseAutoPlayOnManualNavigate, bool? pauseAutoPlayInFiniteScroll, PageStorageKey? pageViewKey, CenterPageEnlargeStrategy? enlargeStrategy, double? enlargeFactor, bool? disableCenter, Clip? clipBehavior, bool? padEnds}) CarouselOptions
Generate new CarouselOptions based on old ones.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited