引入依赖:flutter_swiper: ^1.1.4
代码实现之简单,超出你的想象,盗了张实现效果图如下:
image.png
//照片展示
Padding(
padding: EdgeInsets.fromLTRB(9, 9, 9, 115),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.black),
child: ClipRRect(
borderRadius: BorderRadius.circular(5),
child: Swiper(
itemCount: imageUrls.length,
autoplay: true,
itemBuilder: (BuildContext context, int index) {
return Image.network(
imageUrls[index],
fit: BoxFit.cover,
);
},
pagination: SwiperPagination(),
),
),
)),
return Image.network 处导入你要展示的图片数组即可,return 也可以自定义来进行点击触发事件
网友评论