Esempio n. 1
0
 public PageIndicator(
     Key key                    = null,
     float size                 = 20.0f,
     float space                = 5.0f,
     int?count                  = null,
     float activeSize           = 20.0f,
     PageController controller  = null,
     Color color                = null,
     PageIndicatorLayout layout = PageIndicatorLayout.slide,
     Color activeColor          = null,
     float scale                = 0.6f,
     float dropHeight           = 20.0f
     ) : base(key: key)
 {
     D.assert(count != null);
     D.assert(controller != null);
     this.size        = size;
     this.space       = space;
     this.count       = count.Value;
     this.activeSize  = activeSize;
     this.controller  = controller;
     this.color       = color ?? new Color(0x4DFFFFFF);
     this.layout      = layout;
     this.activeColor = activeColor ?? CColors.White;
     this.scale       = scale;
     this.dropHeight  = dropHeight;
 }
Esempio n. 2
0
        public PageIndicator(

            PageController controller,
            int count,
            Color color                = null,
            Color activeColor          = null,
            float size                 = 20.0f,
            Key key                    = null,
            float space                = 5.0f,
            float activeSize           = 20.0f,
            PageIndicatorLayout layout = PageIndicatorLayout.SLIDE,
            float scale                = 0.6f,
            float dropHeight           = 20.0f) : base(key: key)
        {
            D.assert(controller != null);
            this.space       = space;
            this.size        = size;
            this.count       = count;
            this.activeColor = activeColor ?? Colors.red;
            this.activeSize  = activeSize;
            this.controller  = controller;
            this.color       = color ?? Colors.white30;
            this.layout      = layout;
            this.scale       = scale;
            this.dropHeight  = dropHeight;
        }
Esempio n. 3
0
 public SwiperPluginConfig(
     int activeIndex,
     int itemCount,
     PageIndicatorLayout indicatorLayout,
     bool outer,
     Axis scrollDirection,
     SwiperController controller,
     PageController pageController,
     SwiperLayout layout,
     bool loop)
 {
     D.assert(scrollDirection != null);
     D.assert(controller != null);
     this.activeIndex     = activeIndex;
     this.itemCount       = itemCount;
     this.indicatorLayout = indicatorLayout;
     this.outer           = outer;
     this.scrollDirection = scrollDirection;
     this.controller      = controller;
     this.pageController  = pageController;
     this.layout          = layout;
     this.loop            = loop;
 }
Esempio n. 4
0
    public static Swiper Children(
        Key key,
        IndexedWidgetBuilder itemBuilder,
        PageTransformer transformer,
        int itemCount,
        ValueChanged <int> onIndexChanged,
        int index,
        SwiperOnTap onTap,
        List <SwiperPlugin> plugins,
        SwiperPlugin control,
        ScrollPhysics physics,
        SwiperController controller,
        SwiperPlugin pagination,
        CustomLayoutOption customLayoutOption,
        List <Widget> children,
        /// since v1.0.0
        float containerHeight,
        float containerWidth,
        float itemHeight,
        float itemWidth,
        float scale,
        float fade,

        ///

        Curve curve,
        float viewportFraction = 1.0f,
        bool autoplay          = false,
        bool loop            = true,
        Axis scrollDirection = Axis.horizontal,
        SwiperLayout layout  = SwiperLayout.DEFAULT,
        int autoplayDelay    = kDefaultAutoplayDelayMs,
        bool autoplayDisableOnInteraction = true,
        int duration = kDefaultAutoplayTransactionDuration,
        bool outer   = false,
        PageIndicatorLayout indicatorLayout = PageIndicatorLayout.NONE,
        bool reverse = false

        )
    {
        D.assert(children != null, () => "children must not be null");

        return(new Swiper(
                   transformer: transformer,
                   customLayoutOption: customLayoutOption,
                   containerHeight: containerHeight,
                   containerWidth: containerWidth,
                   viewportFraction: viewportFraction,
                   itemHeight: itemHeight,
                   itemWidth: itemWidth,
                   outer: outer,
                   scale: scale,
                   fade: fade,
                   autoplay: autoplay,
                   autoplayDelay: autoplayDelay,
                   autoplayDisableOnInteraction: autoplayDisableOnInteraction,
                   duration: duration,
                   onIndexChanged: onIndexChanged,
                   index: index,
                   onTap: onTap,
                   curve: curve ?? Curves.ease,
                   scrollDirection: scrollDirection,
                   pagination: pagination,
                   control: control,
                   controller: controller,
                   loop: loop,
                   plugins: plugins,
                   physics: physics,
                   key: key,
                   itemBuilder: (BuildContext context, int ind) =>
        {
            return children[ind];
        },
                   itemCount: children.Count));
    }
Esempio n. 5
0
    public Swiper(

        IndexedWidgetBuilder itemBuilder,
        int itemCount,
        SwiperPlugin pagination,
        SwiperPlugin control,
        /// since v1.0.0
        float containerHeight,
        float containerWidth,
        float itemHeight,
        float itemWidth,
        float scale = 1,
        float fade  = 1,
        CustomLayoutOption customLayoutOption = null,

        SwiperController controller = null,
        PageTransformer transformer = null,
        int index = 0,
        List <SwiperPlugin> plugins       = null,
        ValueChanged <int> onIndexChanged = null,
        ScrollPhysics physics             = null,
        ///
        SwiperOnTap onTap = null,

        Curve curve                       = null,
        Key key                           = null,
        float viewportFraction            = 1.0f,
        bool autoplay                     = false,
        bool loop                         = true,
        Axis scrollDirection              = Axis.horizontal,
        SwiperLayout layout               = SwiperLayout.DEFAULT,
        int autoplayDelay                 = kDefaultAutoplayDelayMs,
        bool autoplayDisableOnInteraction = true,
        int duration                      = kDefaultAutoplayTransactionDuration,
        bool outer                        = false,

        PageIndicatorLayout indicatorLayout = PageIndicatorLayout.NONE
        ) :
        base(key: key)
    {
        D.assert(itemBuilder != null || transformer != null, () => { return("itemBuilder and transformItemBuilder must not be both null"); });
        D.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");

        this.itemBuilder        = itemBuilder;
        this.indicatorLayout    = indicatorLayout;
        this.transformer        = transformer;
        this.onIndexChanged     = onIndexChanged;
        this.itemCount          = itemCount;
        this.index              = index;
        this.onTap              = onTap;
        this.plugins            = plugins;
        this.control            = control;
        this.physics            = physics;
        this.controller         = controller;
        this.pagination         = pagination;
        this.customLayoutOption = customLayoutOption;
        this.containerHeight    = containerHeight;
        this.containerWidth     = containerWidth;
        this.viewportFraction   = viewportFraction;
        this.itemHeight         = itemHeight;
        this.itemWidth          = itemWidth;
        this.scale              = scale;
        this.fade            = fade;
        this.curve           = curve ?? Curves.ease;
        this.autoplay        = autoplay;
        this.loop            = loop;
        this.scrollDirection = scrollDirection;
        this.layout          = layout;
        this.autoplayDelay   = autoplayDelay;
        this.autoplayDisableOnInteraction = autoplayDisableOnInteraction;
        this.duration = duration;
        this.outer    = outer;
    }
Esempio n. 6
0
        public override Widget build(BuildContext context)
        {
            var children = new List <Widget> {
                new Container(
                    width: 1080,
                    height: 800,
                    color: Colors.red
                    ),
                new Container(
                    width: 1080,
                    height: 800,
                    color: Colors.green
                    ),
                new Container(
                    width: 1080,
                    height: 800,
                    color: Colors.blueAccent
                    ),
                new Container(
                    width: 1080,
                    height: 800,
                    color: Colors.grey
                    )
            };

            return(new Scaffold(
                       appBar: new AppBar(
                           title: new Text(widget.title)
                           ),
                       body: new Column(
                           children: new List <Widget> {
                new Row(
                    children: new List <Widget> {
                    new Checkbox(
                        value: loop,
                        onChanged: (va) => {
                        setState(() => {
                            if (va == true)
                            {
                                //controller = new TransformerPageController(itemCount:4,loop:true);
                            }
                            else
                            {
                                //controller = new PageController(initialPage:0);
                            }
                            loop = (bool)va;
                        });
                    }
                        ),
                    new Text("loop")
                }
                    ),
                new RadioGroup(
                    titles: new List <string> {
                    "COLOR", "DROP",
                    "NONE", "SCALE", "SLIDE", "WARM"
                },
                    onIndexChanged: (index) => { setState(() => { _index = index; layout = layouts[index]; }); }

                    ),
                new Container(
                    width: 1080,
                    height: 800,
                    child:
                    new Stack(
                        children: new List <Widget> {
                    TransformerPageView.children(index: 0,
                                                 children: children, pageController: controller
                                                 ),
                    new Align(
                        alignment: Alignment.bottomCenter,
                        child: new Padding(
                            padding: EdgeInsets.only(bottom: 20),
                            child: getItem()

                            )
                        )
                }
                        )
                    )
            }
                           )

                       ));
        }