Ejemplo n.º 1
0
 public _CustomLayoutSwiper(
     CustomLayoutOption option,
     float?itemWidth  = null,
     bool?loop        = null,
     float?itemHeight = null,
     ValueChanged <int> onIndexChanged = null,
     Key key = null,
     IndexedWidgetBuilder itemBuilder = null,
     Curve curve                 = null,
     int?duration                = null,
     int?index                   = null,
     int?itemCount               = null,
     Axis scrollDirection        = Axis.horizontal,
     SwiperController controller = null
     ) : base(
         loop: loop,
         onIndexChanged: onIndexChanged,
         itemWidth: itemWidth,
         itemHeight: itemHeight,
         key: key,
         itemBuilder: itemBuilder,
         curve: curve,
         duration: duration,
         index: index,
         itemCount: itemCount,
         controller: controller,
         scrollDirection: scrollDirection)
 {
     D.assert(option != null);
     this.option = option;
 }
Ejemplo n.º 2
0
 public _StackSwiper(
     Key key      = null,
     Curve curve  = null,
     int?duration = null,
     SwiperController controller       = null,
     ValueChanged <int> onIndexChanged = null,
     float?itemHeight = null,
     float?itemWidth  = null,
     IndexedWidgetBuilder itemBuilder = null,
     int?index            = null,
     bool?loop            = null,
     int?itemCount        = null,
     Axis scrollDirection = Axis.horizontal
     ) : base(
         loop: loop,
         key: key,
         itemWidth: itemWidth,
         itemHeight: itemHeight,
         itemBuilder: itemBuilder,
         curve: curve,
         duration: duration,
         controller: controller,
         index: index,
         onIndexChanged: onIndexChanged,
         itemCount: itemCount,
         scrollDirection: scrollDirection)
 {
 }
Ejemplo n.º 3
0
 public _SubSwiper(
     Key key          = null,
     bool?loop        = null,
     float?itemHeight = null,
     float?itemWidth  = null,
     int?duration     = null,
     Curve curve      = null,
     IndexedWidgetBuilder itemBuilder = null,
     SwiperController controller      = null,
     int?index            = null,
     int?itemCount        = null,
     Axis scrollDirection = Axis.horizontal,
     ValueChanged <int> onIndexChanged = null
     ) : base(key: key)
 {
     this.loop            = loop;
     this.itemHeight      = itemHeight;
     this.itemWidth       = itemWidth;
     this.duration        = duration;
     this.curve           = curve;
     this.itemBuilder     = itemBuilder;
     this.controller      = controller;
     this.index           = index;
     this.itemCount       = itemCount;
     this.scrollDirection = scrollDirection;
     this.onIndexChanged  = onIndexChanged;
 }
Ejemplo n.º 4
0
        public override void initState()
        {
            this._controller = this.widget.controller ?? new SwiperController();

            this._controller.addListener(listener: this._onController);
            this._handleAutoplay();
            base.initState();
        }
Ejemplo n.º 5
0
        public override void didUpdateWidget(StatefulWidget _oldWidget)
        {
            Swiper oldWidget = _oldWidget as Swiper;

            if (this._controller != oldWidget.controller)
            {
                if (oldWidget.controller != null)
                {
                    oldWidget.controller.removeListener(this._onController);
                    this._controller = oldWidget.controller;
                    this._controller.addListener(this._onController);
                }
            }

            this._handleAutoplay();
            base.didUpdateWidget(oldWidget);
        }
Ejemplo n.º 6
0
 public SwiperPluginConfig(
     int?activeIndex = null,
     int?itemCount   = null,
     PageIndicatorLayout?indicatorLayout = null,
     bool?outer                    = null,
     Axis scrollDirection          = Axis.horizontal,
     SwiperController controller   = null,
     PageController pageController = null,
     SwiperLayout layout           = SwiperLayout.normal,
     bool?loop = null
     )
 {
     D.assert(controller != null);
     D.assert(itemCount != null);
     this.activeIndex     = activeIndex;
     this.itemCount       = itemCount.Value;
     this.indicatorLayout = indicatorLayout;
     this.outer           = outer;
     this.scrollDirection = scrollDirection;
     this.controller      = controller;
     this.pageController  = pageController;
     this.layout          = layout;
     this.loop            = loop;
 }
Ejemplo n.º 7
0
 public Swiper(
     IndexedWidgetBuilder itemBuilder    = null,
     PageIndicatorLayout indicatorLayout = PageIndicatorLayout.none,
     PageTransformer transformer         = null,
     int?itemCount       = null,
     bool autoplay       = false,
     SwiperLayout layout = SwiperLayout.normal,
     int autoplayDelay   = SwiperUtils.kDefaultAutoplayDelayMs,
     bool autoplayDisableOnInteraction = true,
     int duration = SwiperUtils.kDefaultAutoplayTransactionDuration,
     ValueChanged <int> onIndexChanged = null,
     int?index                   = null,
     SwiperOnTap onTap           = null,
     SwiperPlugin control        = null,
     bool loop                   = true,
     Curve curve                 = null,
     Axis scrollDirection        = Axis.horizontal,
     SwiperPlugin pagination     = null,
     List <SwiperPlugin> plugins = null,
     ScrollPhysics physics       = null,
     Key key = null,
     SwiperController controller           = null,
     CustomLayoutOption customLayoutOption = null,
     float?containerHeight  = null,
     float?containerWidth   = null,
     float viewportFraction = 1.0f,
     float?itemHeight       = null,
     float?itemWidth        = null,
     bool?outer             = false,
     float?scale            = null,
     float?fade             = null
     ) : base(key: key)
 {
     D.assert(itemBuilder != null || transformer != null,
              () => "itemBuilder and transformItemBuilder must not be both null");
     D.assert(!loop || ((loop && layout == SwiperLayout.normal &&
                         (indicatorLayout == PageIndicatorLayout.scale ||
                          indicatorLayout == PageIndicatorLayout.color ||
                          indicatorLayout == PageIndicatorLayout.none)) ||
                        (loop && layout != SwiperLayout.normal)),
              () => "Only support `PageIndicatorLayout.SCALE` and `PageIndicatorLayout.COLOR`when layout==SwiperLayout.DEFAULT in loop mode"
              );
     this.itemBuilder     = itemBuilder;
     this.indicatorLayout = indicatorLayout;
     this.transformer     = transformer;
     this.itemCount       = itemCount;
     this.autoplay        = autoplay;
     this.layout          = layout;
     this.autoplayDelay   = autoplayDelay;
     this.autoplayDisableOnInteraction = autoplayDisableOnInteraction;
     this.duration           = duration;
     this.onIndexChanged     = onIndexChanged;
     this.index              = index;
     this.onTap              = onTap;
     this.control            = control;
     this.loop               = loop;
     this.curve              = curve ?? Curves.ease;
     this.scrollDirection    = scrollDirection;
     this.pagination         = pagination;
     this.plugins            = plugins;
     this.physics            = physics;
     this.controller         = controller;
     this.customLayoutOption = customLayoutOption;
     this.containerHeight    = containerHeight;
     this.containerWidth     = containerWidth;
     this.viewportFraction   = viewportFraction;
     this.itemHeight         = itemHeight;
     this.itemWidth          = itemWidth;
     this.outer              = outer;
     this.scale              = scale;
     this.fade               = fade;
 }