CardSwiper constructor

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

Implementation

const CardSwiper({
  Key? key,
  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.direction = CardSwiperDirection.right,
  this.isHorizontalSwipingEnabled = true,
  this.isVerticalSwipingEnabled = true,
  this.isLoop = true,
  this.numberOfCardsDisplayed = 2,
  this.onUndo,
})  : 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(
        direction != CardSwiperDirection.none,
        'direction must not be none',
      ),
      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]',
      ),
      super(key: key);