예제 #1
0
 public override void initState()
 {
     _controller = widget.controller;
     if (_controller == null)
     {
         _controller = new SwiperController();
     }
     _controller.addListener(_onController);
     _handleAutoplay();
     base.initState();
 }
예제 #2
0
    public override void didUpdateWidget(StatefulWidget oldWidget)
    {
        Swiper sp = oldWidget as Swiper;

        if (sp != null && _controller != sp.controller)
        {
            if (sp.controller != null)
            {
                sp.controller.removeListener(_onController);
                _controller = sp.controller;
                _controller.addListener(_onController);
            }
        }
        _handleAutoplay();
        base.didUpdateWidget(oldWidget);
    }