CardSwiper constructor

const CardSwiper({
  1. required NullableCardBuilder cardBuilder,
  2. required int cardsCount,
  3. CardSwiperController? controller,
  4. int initialIndex = 0,
  5. EdgeInsetsGeometry padding = const EdgeInsets.symmetric(horizontal: 20, vertical: 25),
  6. Duration duration = const Duration(milliseconds: 200),
  7. double maxAngle = 30,
  8. int threshold = 50,
  9. double scale = 0.9,
  10. bool isDisabled = false,
  11. CardSwiperOnTapDisabled? onTapDisabled,
  12. CardSwiperOnSwipe? onSwipe,
  13. CardSwiperOnEnd? onEnd,
  14. CardSwiperDirectionChange? onSwipeDirectionChange,
  15. AllowedSwipeDirection allowedSwipeDirection = const AllowedSwipeDirection.all(),
  16. bool isLoop = true,
  17. int numberOfCardsDisplayed = 2,
  18. CardSwiperOnUndo? onUndo,
  19. Offset backCardOffset = const Offset(0, 40),
  20. Key? key,
})

Implementation

const CardSwiper({
  required this.cardBuilder,
  required this.cardsCount,
  this.controller,
  this.initialIndex = 0,
  this.padding = const EdgeInsets.symmetric(horizontal: 20, vertical: 25),
  this.duration = const Duration(milliseconds: 200),
  this.maxAngle = 30,
  this.threshold = 50,
  this.scale = 0.9,
  this.isDisabled = false,
  this.onTapDisabled,
  this.onSwipe,
  this.onEnd,
  this.onSwipeDirectionChange,
  this.allowedSwipeDirection = const AllowedSwipeDirection.all(),
  this.isLoop = true,
  this.numberOfCardsDisplayed = 2,
  this.onUndo,
  this.backCardOffset = const Offset(0, 40),
  super.key,
})  : assert(
        maxAngle >= 0 && maxAngle <= 360,
        'maxAngle must be between 0 and 360',
      ),
      assert(
        threshold >= 1 && threshold <= 100,
        'threshold must be between 1 and 100',
      ),
      assert(
        scale >= 0 && scale <= 1,
        'scale must be between 0 and 1',
      ),
      assert(
        numberOfCardsDisplayed >= 1 && numberOfCardsDisplayed <= cardsCount,
        'you must display at least one card, and no more than [cardsCount]',
      ),
      assert(
        initialIndex >= 0 && initialIndex < cardsCount,
        'initialIndex must be between 0 and [cardsCount]',
      );