flutter_swiper: flutter最强大的siwiper, 多种布局方式,无限轮播,Android和IOS双端适配.
1,添加依赖
flutter_swiper: ^1.1.6
复制代码
2,下载依赖
flutter pub get复制代码
3,导入依赖
import 'package:flutter_swiper/flutter_swiper.dart';
复制代码
4,简单使用
class MySwiper extends StatefulWidget {
@override
_MySwiperState createState() => _MySwiperState();
}
class _MySwiperState extends State<MySwiper> {
@override
Widget build(BuildContext context) {
return Container(
child: Swiper(
itemBuilder: (context,position){
return Image.network("http://pic1.win4000.com/pic/9/6d/cbc11464568.jpg");
},
itemCount: 3,
pagination: SwiperPagination(),
control: SwiperControl(),
viewportFraction: 0.8,
scale: 0.9,
),
);
}
}复制代码
5,示例(官方文档比较详细:点击进入)
