Swiper constructor
Swiper({
- required IndexedWidgetBuilder itemBuilder,
- PageIndicatorLayout indicatorLayout = PageIndicatorLayout.NONE,
- PageTransformer? transformer,
- required int itemCount,
- bool autoplay = false,
- SwiperLayout? layout = SwiperLayout.DEFAULT,
- int autoplayDelay = kDefaultAutoplayDelayMs,
- bool autoplayDisableOnInteraction = true,
- int duration = kDefaultAutoplayTransactionDuration,
- ValueChanged<
int> ? onIndexChanged, - int? index,
- SwiperOnTap? onTap,
- SwiperPlugin? control,
- bool loop = true,
- Curve curve = Curves.ease,
- Axis scrollDirection = Axis.horizontal,
- SwiperPlugin? pagination,
- List<
SwiperPlugin> ? plugins, - ScrollPhysics? physics,
- Key? key,
- SwiperController? controller,
- CustomLayoutOption? customLayoutOption,
- double? containerHeight,
- double? containerWidth,
- double viewportFraction = 1.0,
- double itemHeight = double.infinity,
- double itemWidth = double.infinity,
- bool outer = false,
- double? scale,
- double? fade,
Implementation
Swiper({
required this.itemBuilder,
this.indicatorLayout = PageIndicatorLayout.NONE,
///
this.transformer,
required this.itemCount,
this.autoplay = false,
this.layout = SwiperLayout.DEFAULT,
this.autoplayDelay = kDefaultAutoplayDelayMs,
this.autoplayDisableOnInteraction = true,
this.duration = kDefaultAutoplayTransactionDuration,
this.onIndexChanged,
this.index,
this.onTap,
this.control,
this.loop = true,
this.curve = Curves.ease,
this.scrollDirection = Axis.horizontal,
this.pagination,
this.plugins,
this.physics,
Key? key,
this.controller,
this.customLayoutOption,
/// since v1.0.0
this.containerHeight,
this.containerWidth,
this.viewportFraction = 1.0,
this.itemHeight = double.infinity,
this.itemWidth = double.infinity,
this.outer = false,
this.scale,
this.fade,
}) : assert(
!loop ||
((loop &&
layout == SwiperLayout.DEFAULT &&
(indicatorLayout == PageIndicatorLayout.SCALE ||
indicatorLayout == PageIndicatorLayout.COLOR ||
indicatorLayout == PageIndicatorLayout.NONE)) ||
(loop && layout != SwiperLayout.DEFAULT)),
"Only support `PageIndicatorLayout.SCALE` and `PageIndicatorLayout.COLOR`when layout==SwiperLayout.DEFAULT in loop mode"),
super(key: key);