如何将颤动颤动附加到任何滚动视图

时间:2020-04-21 22:19:05

标签: flutter scroll swiper

如何将颤动刷卡附加到任何滚动视图?我有水平刷卡,我向下滚动ui,然后向后滚动(向上),作为结果,我得到异常“ ScrollController未附加到任何滚动视图”。 我应该怎么做才能解决它。您能帮我吗?

 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,
                );
              }),
        );
      }
    }

0 个答案:

没有答案