key: UniqueKey()
Swiper(
key: UniqueKey(), //添加key
autoplay: true,
loop: (widget.datas.length > 1) ? true : false,
physics: const PageScrollPhysics(parent: const BouncingScrollPhysics()),
itemBuilder: (BuildContext context, int index) {
return getBannerView(index);
},
viewportFraction: viewportFraction,
scale: 1,
itemCount: widget.datas.length,
//条目个数
)
flutter 页面刷新key相关:
https://blog.csdn.net/qq_17766199/article/details/104745624