CardCarouselController constructor
CardCarouselController({
- required TickerProvider vsync,
- required int itemCount,
- int initialIndex = 0,
- Duration expandDuration = const Duration(milliseconds: 380),
- Duration collapseDuration = const Duration(milliseconds: 340),
- Curve expandCurve = Curves.easeOutCubic,
- Curve collapseCurve = Curves.easeInOutCubic,
- double verticalDragThreshold = 0.35,
- 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,
);
}