copyWith method

CarouselOptions copyWith({
  1. double? height,
  2. double? aspectRatio,
  3. double? viewportFraction,
  4. int? initialPage,
  5. bool? enableInfiniteScroll,
  6. bool? reverse,
  7. bool? autoPlay,
  8. Duration? autoPlayInterval,
  9. Duration? autoPlayAnimationDuration,
  10. Curve? autoPlayCurve,
  11. bool? enlargeCenterPage,
  12. dynamic onPageChanged(
    1. int index,
    2. CarouselPageChangedReason reason
    )?,
  13. ValueChanged<double?>? onScrolled,
  14. ScrollPhysics? scrollPhysics,
  15. bool? pageSnapping,
  16. Axis? scrollDirection,
  17. bool? pauseAutoPlayOnTouch,
  18. bool? pauseAutoPlayOnManualNavigate,
  19. bool? pauseAutoPlayInFiniteScroll,
  20. PageStorageKey? pageViewKey,
  21. CenterPageEnlargeStrategy? enlargeStrategy,
  22. double? enlargeFactor,
  23. bool? disableCenter,
  24. Clip? clipBehavior,
  25. bool? padEnds,
})

Generate new CarouselOptions based on old ones.

Implementation

CarouselOptions copyWith(
        {double? height,
        double? aspectRatio,
        double? viewportFraction,
        int? initialPage,
        bool? enableInfiniteScroll,
        bool? reverse,
        bool? autoPlay,
        Duration? autoPlayInterval,
        Duration? autoPlayAnimationDuration,
        Curve? autoPlayCurve,
        bool? enlargeCenterPage,
        Function(int index, CarouselPageChangedReason reason)? onPageChanged,
        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(
      height: height ?? this.height,
      aspectRatio: aspectRatio ?? this.aspectRatio,
      viewportFraction: viewportFraction ?? this.viewportFraction,
      initialPage: initialPage ?? this.initialPage,
      enableInfiniteScroll: enableInfiniteScroll ?? this.enableInfiniteScroll,
      reverse: reverse ?? this.reverse,
      autoPlay: autoPlay ?? this.autoPlay,
      autoPlayInterval: autoPlayInterval ?? this.autoPlayInterval,
      autoPlayAnimationDuration:
          autoPlayAnimationDuration ?? this.autoPlayAnimationDuration,
      autoPlayCurve: autoPlayCurve ?? this.autoPlayCurve,
      enlargeCenterPage: enlargeCenterPage ?? this.enlargeCenterPage,
      onPageChanged: onPageChanged ?? this.onPageChanged,
      onScrolled: onScrolled ?? this.onScrolled,
      scrollPhysics: scrollPhysics ?? this.scrollPhysics,
      pageSnapping: pageSnapping ?? this.pageSnapping,
      scrollDirection: scrollDirection ?? this.scrollDirection,
      pauseAutoPlayOnTouch: pauseAutoPlayOnTouch ?? this.pauseAutoPlayOnTouch,
      pauseAutoPlayOnManualNavigate:
          pauseAutoPlayOnManualNavigate ?? this.pauseAutoPlayOnManualNavigate,
      pauseAutoPlayInFiniteScroll:
          pauseAutoPlayInFiniteScroll ?? this.pauseAutoPlayInFiniteScroll,
      pageViewKey: pageViewKey ?? this.pageViewKey,
      enlargeStrategy: enlargeStrategy ?? this.enlargeStrategy,
      enlargeFactor: enlargeFactor ?? this.enlargeFactor,
      disableCenter: disableCenter ?? this.disableCenter,
      clipBehavior: clipBehavior ?? this.clipBehavior,
      padEnds: padEnds ?? this.padEnds,
    );