首页 > 其他 > 详细

2019.8.30 记录一个Swiper的使用

时间:2019-08-30 12:57:54      阅读:105      评论:0      收藏:0      [点我收藏+]

导入     flutter_swiper: ^1.1.6

引入     import ‘package:flutter_screenutil/flutter_screenutil.dart‘;

 

已下是一个完整的swiper的代码

Container(
        height: 200,
        child: Swiper(
          itemCount: imagePaths.length,
          itemHeight: 200,
          itemWidth: 375,
          autoplay: true, // 自动播放
          layout: SwiperLayout.STACK, // 样式
          pagination: SwiperPagination(),// 添加一个页码指示器
          itemBuilder: (context, index) {
            return Container(
              color: Colors.grey,
              child: Image.network(
                imagePaths[index],
                fit: BoxFit.cover,
              ),
            );
          },
        ),
      )

 

final imagePaths = [
    http://pic1.win4000.com/wallpaper/c/53cdd1f7c1f21.jpg,
    http://pic25.nipic.com/20121112/9252150_150552938000_2.jpg,
    http://pic51.nipic.com/file/20141025/8649940_220505558734_2.jpg,
    http://gss0.baidu.com/-fo3dSag_xI4khGko9WTAnF6hhy/lvpics/w=600/sign=1350023d79899e51788e391472a5d990/b21bb051f819861810d03e4448ed2e738ad4e65f.jpg,
    http://a.hiphotos.baidu.com/lvpics/h=800/sign=5a82402cd5ca7bcb627bca2f8e086b3f/caef76094b36acaf0651ef137ed98d1000e99caf.jpg,
    http://pic39.nipic.com/20140320/12795880_110914420143_2.jpg,
    http://pic38.nipic.com/20140217/7643674_131828170000_2.jpg,
  ];

 

2019.8.30 记录一个Swiper的使用

原文:https://www.cnblogs.com/110-913-1025/p/11434250.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!