Пример #1
0
        bool _handleScrollStart(ScrollStartNotification notification)
        {
            // This is used to interrupt useless callback when the pull up load rolls back.
            if (notification.metrics.outOfRange())
            {
                return(false);
            }

            GestureProcessor topWrap    = this._headerKey.currentState as GestureProcessor;
            GestureProcessor bottomWrap = this._footerKey.currentState as GestureProcessor;

            if (this.widget.enablePullUp)
            {
                bottomWrap.onDragStart(notification);
            }

            if (this.widget.enablePullDown)
            {
                topWrap.onDragStart(notification);
            }

            return(false);
        }
Пример #2
0
    Widget _buildSwiper()
    {
        IndexedWidgetBuilder itemBuilder;

        if (widget.onTap != null)
        {
            itemBuilder = _wrapTap;
        }
        else
        {
            itemBuilder = widget.itemBuilder;
        }

        if (widget.layout == SwiperLayout.STACK)
        {
            return(new _StackSwiper(
                       loop: widget.loop,
                       itemWidth: widget.itemWidth,
                       itemHeight: widget.itemHeight,
                       itemCount: widget.itemCount,
                       itemBuilder: itemBuilder,
                       index: _activeIndex,
                       curve: widget.curve,
                       duration: widget.duration,
                       onIndexChanged: _onIndexChanged,
                       controller: _controller,
                       scrollDirection: widget.scrollDirection


                       ));
        }
        else if (_isPageViewLayout())
        {
            PageTransformer transformer = widget.transformer;
            if (widget.scale != 0 || widget.fade != 0)
            {
                transformer =
                    new ScaleAndFadeTransformer(scale: widget.scale, fade: widget.fade);
            }

            Widget child = new TransformerPageView(
                pageController: _pageController,
                loop: widget.loop,
                itemCount: widget.itemCount,
                itemBuilder: itemBuilder,
                transformer: transformer,
                viewportFraction: widget.viewportFraction,
                index: _activeIndex,
                duration: TimeSpan.FromMilliseconds(widget.duration),
                scrollDirection: widget.scrollDirection,
                onPageChanged: _onIndexChanged,
                curve: widget.curve,
                physics: widget.physics,
                controller: _controller


                );
            if (widget.autoplayDisableOnInteraction && widget.autoplay)
            {
                return(new NotificationListener <ScrollNotification>(
                           child: child,
                           onNotification: (ScrollNotification notification) =>
                {
                    ScrollStartNotification ssno = notification as ScrollStartNotification;
                    if (ssno != null)
                    {
                        if (ssno.dragDetails != null)
                        {
                            //by human
                            if (_timer != null)
                            {
                                _stopAutoplay();
                            }
                        }
                    }
                    else if (notification is ScrollEndNotification)
                    {
                        if (_timer == null)
                        {
                            _startAutoplay();
                        }
                    }

                    return false;
                }
                           ));
            }

            return(child);
        }
        else if (widget.layout == SwiperLayout.TINDER)
        {
            return(new _TinderSwiper(
                       loop: widget.loop,
                       itemWidth: widget.itemWidth,
                       itemHeight: widget.itemHeight,
                       itemCount: widget.itemCount,
                       itemBuilder: itemBuilder,
                       index: _activeIndex,
                       curve: widget.curve,
                       duration: widget.duration,
                       onIndexChanged: _onIndexChanged,
                       controller: _controller,
                       scrollDirection: widget.scrollDirection
                       ));
        }
        else if (widget.layout == SwiperLayout.CUSTOM)
        {
            return(new _CustomLayoutSwiper(
                       loop: widget.loop,
                       option: widget.customLayoutOption,
                       itemWidth: widget.itemWidth,
                       itemHeight: widget.itemHeight,
                       itemCount: widget.itemCount,
                       itemBuilder: itemBuilder,
                       index: _activeIndex,
                       curve: widget.curve,
                       duration: widget.duration,
                       onIndexChanged: _onIndexChanged,
                       controller: _controller,
                       scrollDirection: widget.scrollDirection
                       ));
        }
        else
        {
            return(new Container());
        }
    }
Пример #3
0
        public void onDragStart(ScrollStartNotification notification)
        {
//            throw new NotImplementedException();
        }