rommy
rommy

Reputation: 195

How to attach flutter swiper to any scroll views

How to attach flutter swiper to any scroll views?I have horizontal swiper,i scroll down my ui and then i scroll back(up), as a rezult i get Exception 'ScrollController not attached to any scroll views'. What i should do to fix it.Could you help me?

 class SwiperTop extends StatelessWidget {
      MBloc _Bloc = BlocProvider.getBloc<MBloc>();

      @override
      Widget build(BuildContext context) {
        return Container(
          height: 284.0,
          child: StreamBuilder(
              initialData: List<MEntity>(),
              stream: _mBloc.listMoviesFlux,
              builder: (BuildContext context, AsyncSnapshot snapshot) {
                if (!snapshot.hasData) return Container(height: 1, width: 1);
                return Swiper(
                  loop: true,
                  itemCount: snapshot.data.length,
                  itemBuilder: (BuildContext context, int index) {
                    return _itemM(snapshot.data[index], context, index);
                  },
                  viewportFraction: 0.8,
                  scale: 0.8,
                  autoplay: true,
                  duration: 300,
                  autoplayDelay: 3000,
                  index: 0,
                );
              }),
        );
      }
    }

Upvotes: 2

Views: 301

Answers (0)

Related Questions