28 Flutter 轮播图 flutter_swiper
中文地址:
https://github.com/best-flutter/flutter_swiper/blob/master/README-ZH.md
基本参数
| 参数 | 默认值 | 描述 |
|---|---|---|
| scrollDirection | Axis.horizontal | 滚动方向,设置为Axis.vertical如果需要垂直滚动 |
| loop | true | 无限轮播模式开关 |
| index | 0 | 初始的时候下标位置 |
| autoplay | false | 自动播放开关. |
| onIndexChanged | void onIndexChanged(int index) | 当用户手动拖拽或者自动播放引起下标改变的时候调用 |
| onTap | void onTap(int index) | 当用户点击某个轮播的时候调用 |
| duration | 300.0 | 动画时间,单位是毫秒 |
| pagination | null | 设置 new SwiperPagination() 展示默认分页指示器 |
| control | null | 设置 new SwiperControl() 展示默认分页按钮 |
分页指示器
分页指示器继承自 SwiperPlugin,SwiperPlugin 为 Swiper 提供额外的界面.设置为new SwiperPagination() 展示默认分页.
| 参数 | 默认值 | 描述 |
|---|---|---|
| alignment | Alignment.bottomCenter | 如果要将分页指示器放到其他位置,那么可以修改这个参数 |
| margin | const EdgeInsets.all(10.0) | 分页指示器与容器边框的距离 |
| builder | SwiperPagination.dots | 目前已经定义了两个默认的分页指示器样式: SwiperPagination.dots 、 SwiperPagination.fraction,都可以做进一步的自定义. |
案例:
pubspec.yaml
import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart'; class SwiperPage extends StatefulWidget {
SwiperPage({Key key}) : super(key: key); _SwiperPageState createState() => _SwiperPageState();
} class _SwiperPageState extends State<SwiperPage> {
List<Map> imgList = [
{"url": "https://www.itying.com/images/flutter/1.png"},
{"url": "https://www.itying.com/images/flutter/2.png"},
{"url": "https://www.itying.com/images/flutter/3.png"}
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('轮播图组件演示'),
),
body: Column(
children: <Widget>[
Container(
width: double.infinity,
// height: 150,
child: AspectRatio(
aspectRatio: / ,
child: Swiper(
itemBuilder: (BuildContext context, int index) {
return new Image.network(
imgList[index]['url'],
fit: BoxFit.fill,
);
},
itemCount: imgList.length,
pagination: new SwiperPagination(),
loop: true,
autoplay: true,
// control: new SwiperControl(),
),
),
)
],
),
);
}
}
28 Flutter 轮播图 flutter_swiper的更多相关文章
- Flutter轮播图
前端开发当中最有意思的就是实现动画特效,Flutter提供的各种动画组件可以方便实现各种动画效果.Flutter中的动画组件主要分为两类: 隐式动画控件:只需设置组件开始值,结束值,执行时间,比如An ...
- 05-06 Flutter JSON和序列化反序列化、创建模型类转换Json数据、轮播图数据渲染:Flutter创建商品数据模型 、请求Api接口渲染热门商品 推荐商品
Config.dart class Config{ static String domain='http://jd.itying.com/'; } FocusModel.dart class Focu ...
- 7、Flutter banner_view 轮播图的使用
1.前言 实现轮播图,效果如下: 2.实现 将采用 banner_view 实现:资源库地址 2.1.yaml 引入依赖 在 pubspec.yaml 声明需要引用的库,执行命令 flutter pa ...
- Flutter学习五之网络请求和轮播图的实现
上期讲到了,怎样实现一个下拉刷新和加载更多的列表,数据更新,需要使用到网络请求,在flutter中,怎样实现一个网络请求呢?官方使用的是dart io中的HttpClient发起的请求,但HttpCl ...
- ViewPager轮播图
LoopViewPagerLayout无限轮播 项目地址:https://github.com/why168/LoopViewPagerLayout 支持三种动画: 支持修改轮播的速度: 支持修改滑动 ...
- 从零开始,搭建博客系统MVC5+EF6搭建框架(5),博客详情页、留言、轮播图管理、右侧统计博文
一.博客系统进度回顾 上一遍博客介绍到,系统已经实现到了发布以及前台布局展示,接下来就是实现一些,详情页,留言.轮播图管理.右侧博文统计信息实现. 二.博客系统详情页实现 2.1先来看看详情页展示的效 ...
- (新手向)基于Bootstrap的简单轮播图的手机实现
个人电脑里存了不少适合手机欣赏的图片,但是放手机里看是件很占据资源的事.鉴于家里有一台电脑经常开着,正好用来做家庭局域网共享,于是笔者就设想通过一种比较简单环保的思路.通过手机访问电脑内的图片. 首先 ...
- CSS3最简洁的轮播图
<!DOCTYPE html> <html> <head> <title>CSS3最简洁的轮播图</title> <style> ...
- 纯css3 轮播图 利用keyframes
效果: 关键点:利用keyframes 原理:infinite 注意点:在处理关键帧动画的时候,注意处理好 总共花费的 animation-duration:time 与每帧延延迟的时间的交错:要让 ...
随机推荐
- vue 关于vuex
<!-- vuex 配置js store.js -->1.引入vue和vuex import Vue from 'vue'import Vuex from 'vuex'Vue.use(Vu ...
- G1垃圾收集器角色划分与重要概念详解【纯理论】
继续接着上一次[https://www.cnblogs.com/webor2006/p/11129326.html]对G1进行理论化的学习,上一次学到了G1收集器的堆结构,回忆下: 接着继续对它进行了 ...
- 1204 中间件以及cookie,session
目录 一 .cookie与session原理 1.cookie 操作 1.1 设置cookie set_cookie 1.2 获取cookie request.COOKIES.get('k1') 1. ...
- python 操作 MySQL 即相关问题
导入pymysql import pymysql # 创建connect()对象 conn = pymysql.connect( host = '127.0.0.1', port = 3306, us ...
- 2019-2020-1 20199312《Linux内核原理与分析》第五周作业
使用库函数API获取当前时间 #include <stdio.h> #include <time.h> int main() { time_tt tt; struct tm * ...
- Windows10-Neo4j安装问题及解决方案
暑假都过得差不多了才终于开始搭环境了 1.下载Neo4j Neo4j官网下载翻墙的话还可以 不翻墙的话下了好几次都下不下来 不用下载desktop,下载community server就可以了 2.下 ...
- BigDecimal计算
货币金额的计算 - Java中的BigDecimal 在<Effective Java>这本书中也提到这个原则,float和double只能用来做科学计算或者是工程计算,在商业计算中我 ...
- Linux 查看系统配置参数
原文链接:http://www.cnblogs.com/aric2016/p/10971690.html 查看 cpu信息: cat /proc/cpuinfo 查看内存信息: grep MemTot ...
- jQuery的ajax()方法提交数组问题
http://blog.csdn.net/thc1987/article/details/7278269 解决办法是添加一个属性 traditional:true $.ajax({ type: ...
- bzoj 5206
$n$ 点 $m$ 边图的有限制三元环个数 首先将所有左右端点并且属性相同的边的权值相加,合并为一条边 在这只之前得先排序排序之前得先判断是否需要交换左右端点的位置 T_T 然后统计三元环 补充说明按 ...