CardCarouselController constructor

CardCarouselController({
  1. required TickerProvider vsync,
  2. required int itemCount,
  3. int initialIndex = 0,
  4. Duration expandDuration = const Duration(milliseconds: 380),
  5. Duration collapseDuration = const Duration(milliseconds: 340),
  6. Curve expandCurve = Curves.easeOutCubic,
  7. Curve collapseCurve = Curves.easeInOutCubic,
  8. double verticalDragThreshold = 0.35,
  9. double velocityThresholdVertical = 800.0,
})

Implementation

CardCarouselController({
  required TickerProvider vsync,
  required int itemCount,
  int initialIndex = 0,
  this.expandDuration = const Duration(milliseconds: 380),
  this.collapseDuration = const Duration(milliseconds: 340),
  this.expandCurve = Curves.easeOutCubic,
  this.collapseCurve = Curves.easeInOutCubic,
  this.verticalDragThreshold = 0.35,
  this.velocityThresholdVertical = 800.0,
}) {
  _animationController = AnimationController(
    vsync: vsync,
    value: 0.0,
    lowerBound: 0.0,
    upperBound: 1.0,
  );
  _animationController.addListener(_onAnimationTick);
  _animationController.addStatusListener(_onAnimationStatus);

  _state = CardCarouselState(
    verticalProgress: 0.0,
    currentIndex: itemCount > 0 ? initialIndex.clamp(0, itemCount - 1) : 0,
    phase: CardPhase.collapsedCard,
    itemCount: itemCount,
  );
}