CardSwiper<T extends Widget> constructor
const
CardSwiper<T extends Widget> ({
- Key? key,
- required NullableIndexedWidgetBuilder cardBuilder,
- required int cardsCount,
- CardSwiperController? controller,
- int initialIndex = 0,
- EdgeInsetsGeometry padding = const EdgeInsets.symmetric(horizontal: 20, vertical: 25),
- Duration duration = const Duration(milliseconds: 200),
- double maxAngle = 30,
- int threshold = 50,
- double scale = 0.9,
- bool isDisabled = false,
- CardSwiperOnTapDisabled? onTapDisabled,
- CardSwiperOnSwipe? onSwipe,
- CardSwiperOnEnd? onEnd,
- CardSwiperDirection direction = CardSwiperDirection.right,
- bool isHorizontalSwipingEnabled = true,
- bool isVerticalSwipingEnabled = true,
- bool isLoop = true,
- int numberOfCardsDisplayed = 2,
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,
}) : 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 the length of cards parameter',
),
assert(
initialIndex >= 0 && initialIndex < cardsCount,
'initialIndex must be between 0 and cardsCount',
),
super(key: key);