CarouselOptions class
Constructors
CarouselOptions ({double ? height , double ? aspectRatio , double viewportFraction = 0.9 , int initialPage = 0 , bool enableInfiniteScroll = false , bool reverse = false , bool autoPlay = false , Duration autoPlayInterval = const Duration(seconds: 5) , Duration autoPlayAnimationDuration = const Duration(milliseconds: 300) , Curve autoPlayCurve = Curves.easeInCubic , bool ? enlargeCenterPage = false , CarouselController ? controller , dynamic onPageChanged (int index , CarouselPageChangedReason reason )?, ValueChanged <double ? > ? onScrolled , ScrollPhysics ? physics = const BouncingScrollPhysics() , Axis scrollDirection = Axis.horizontal , bool pauseAutoPlayOnTouch = true , bool pauseAutoPlayOnManualNavigate = true , bool pauseAutoPlayInFiniteScroll = false , PageStorageKey ? pageViewKey , bool keepPage = true , CenterPageEnlargeStrategy enlargeStrategy = CenterPageEnlargeStrategy.scale , bool disableCenter = false , bool showIndicator = true , bool floatingIndicator = true , double ? indicatorMargin = 8.0 , SlideIndicator ? slideIndicator = const CircularSlideIndicator() , Clip clipBehavior = Clip.antiAlias , ScrollBehavior ? scrollBehavior , bool pageSnapping = true , bool padEnds = true , DragStartBehavior dragStartBehavior = DragStartBehavior.start , bool allowImplicitScrolling = false , String ? restorationId })
Properties
allowImplicitScrolling
→ bool
Controls whether the widget's pages will respond to RenderObject.showOnScreen , which will allow for implicit accessibility scrolling.
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
The content will be clipped (or not) according to this option.
final
controller
→ CarouselController ?
A MapController
, used to control the map.
final
disableCenter
→ bool
Whether or not to disable the Center
widget for each slide.
final
dragStartBehavior
→ DragStartBehavior
Determines the way that drag start behavior is handled.
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 then the side images,
creating a feeling of depth in the carousel.
final
enlargeStrategy
→ CenterPageEnlargeStrategy
Use enlargeStrategy
to determine which method to enlarge the center page.
final
floatingIndicator
→ bool
Whether or not to float SlideIndicator
over Carousel
.
final
hashCode
→ int
The hash code for this object.
no setter inherited
height
→ double ?
Set carousel height and overrides any existing aspectRatio .
final
indicatorMargin
→ double ?
Indicator margin
final
initialPage
→ int
The initial page to show when first creating the CarouselSlider
.
final
keepPage
→ bool
Whether or not to keep pages in PageView
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
physics
→ ScrollPhysics ?
How the carousel should respond to user input.
final
restorationId
→ String ?
Restoration ID to save and restore the scroll offset of the scrollable.
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 setter inherited
scrollBehavior
→ ScrollBehavior ?
A ScrollBehavior that will be applied to this widget individually.
final
scrollDirection
→ Axis
The axis along which the page view scrolls.
final
showIndicator
→ bool
Whether or not to show the SlideIndicator
for each slide.
final
slideIndicator
→ SlideIndicator ?
Use slideIndicator
to determine which indicator you want to show for each slide.
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 , Axis ? scrollDirection , CarouselController ? carouselController , dynamic onPageChanged (int index , CarouselPageChangedReason reason )?, ValueChanged <double ? > ? onScrolled , ScrollPhysics ? physics , bool ? pageSnapping , bool ? pauseAutoPlayOnTouch , bool ? pauseAutoPlayOnManualNavigate , bool ? pauseAutoPlayInFiniteScroll , PageStorageKey ? pageViewKey , CenterPageEnlargeStrategy ? enlargeStrategy , bool ? disableCenter , SlideIndicator ? slideIndicator , bool ? showIndicator , bool ? floatingIndicator , double ? indicatorMargin , bool ? keepPage , bool ? padEnds , Clip ? clipBehavior , DragStartBehavior ? dragStartBehavior , ScrollBehavior ? scrollBehavior , bool ? allowImplicitScrolling , String ? restorationId })
→ CarouselOptions
Copy With Constructor
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString ()
→ String
A string representation of this object.
inherited
flutter_carousel_widget 2.2.0