flutter_swiper:Another exception was thrown: ScrollController attached to multiple scroll views.
Another exception was thrown: ScrollController attached to multiple scroll views.
翻译一下:引发了另一个异常:ScrollController连接到多个滚动视图。
Flutter Swiper是一个轮播图组件,内部包含一个Widget List,当这个Widget List数量大于1,就可能会有这种情况
解决方案:给Swiper加一个Key即可解决
原有代码
return Container(
child: AspectRatio(
aspectRatio: 1.5 / 1, // 宽高比450/300
child: Swiper(
itemBuilder: (BuildContext context, int index) {
return new Image.network(
imgList[index]['url'],
fit: BoxFit.fill,
);
},
itemCount: imgList.length,
pagination: new SwiperPagination(),
control: new SwiperControl(),
autoplay: true,
),
),
);
更新代码
return Container(
child: AspectRatio(
aspectRatio: 1.5 / 1, // 宽高比450/300
child: Swiper(
key: UniqueKey(), // 这个必须添加,代表唯一
itemBuilder: (BuildContext context, int index) {
return new Image.network(
imgList[index]['url'],
fit: BoxFit.fill,
);
},
itemCount: imgList.length,
pagination: new SwiperPagination(),
control: new SwiperControl(),
autoplay: true,
),
),
);
大功告成!!
flutter_swiper:Another exception was thrown: ScrollController attached to multiple scroll views.的更多相关文章
- myeclipse报错:Could not create the view: An unexpected exception was thrown.
打开server窗口,发现显示:Could not create the view: An unexpected exception was thrown. 此处解决方法: 关闭myeclipse 删 ...
- MyEclipse无法创建servers视图:Could not create the view: An unexpected exception was thrown
今天上班刚打开MyEclipse,就发现servers视图无法打开了,显示:Could not create the view: An unexpected exception was thrown. ...
- (转)Could not create the view: An unexpected exception was thrown. 电脑突然断电,myeclipse非正常关闭,出现错误
问题:电脑突然断电,myeclipse非正常关闭,“Package Explorer”非正常显示,出现错误“Could not create the view: An unexpected excep ...
- Could not create the view: An unexpected exception was thrown 异常处理
MyEclipse 打开后有时候莫名的在server窗口里抛出"Could not create the view: An unexpected exception was thrown&q ...
- Could not create the view: An unexpected exception was thrown. 电脑突然断电,myeclipse非正常关闭,出现错误
电脑突然断电,myeclipse非正常关闭,“Package Explorer”非正常显示,出现错误“Could not create the view: An unexpected exceptio ...
- MyEclipse server窗口 Could not create the view: An unexpected exception was thrown 错误解决
MyEclipse 打开后有时候莫名的在server窗口里抛出“Could not create the view: An unexpected exception was thrown”错误,解决办 ...
- FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:javax.jdo.JDODataStoreException: An exception was thrown while adding/validating class(es) :
在hive命令行创建表时报错: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. ...
- Could not create the view: An unexpected exception was thrown的解决方法
MyEclipse下面的server窗口突然不能正常显示了,而且还显示Could not create the view: An unexpected exception was thrown(无法创 ...
- MyEclipse Could not create the view: An unexpected exception was thrown解决方案
问题:电脑突然断电,myeclipse非正常关闭,“Package Explorer”非正常显示,出现错误“Could not create the view: An unexpected excep ...
- flutter dialog异常Another exception was thrown: Navigator operation requested with a context that does not include a Navigator
我在使用flutter里的对话框控件的时候遇到了一个奇怪的错误 Another exception was thrown: Navigator operation requested with a c ...
随机推荐
- 三十五、kubernetes NameSpace介绍
Kubernetes NameSpace 介绍 Kubernetes使用命名空间的概念帮助解决集群中在管理对象时的复杂性问题.命名空间允许将对象分组到一起,便于将它们作为一个单元进行筛选和控制.无论是 ...
- Debian玩红警2
Debian玩红警2 1. 安装wine sudo apt update sudo apt install wine wine --version wine-5.0.3 (Debian 5.0.3-3 ...
- vue-axios删除操作
<template> <div class="nav"> <input v-model="location" type=" ...
- CSP2022-J/S 游记
Day -2147483648 初赛 J组: 水. 单选没啥好说的,那道联通的傻掉挂了 \(2\). 读程 \(T1\) 手搓,\(T2\) 找规律(判断第一题蒙的,懒得算),\(T3\) 没注意 \ ...
- 关于model,modelsmanager,db以及phql之间关系的梳理
摘要: model在前,db在model后面作为驱动支持.phql是phalcon自创的查询语言,主要特性是在sql语句中用模型名替代表名,其聪明地解析模型类,包括关联关系等,还支持参数绑定.mode ...
- Linux 使用打印机
前言 在 deepin 上打印机好使,在我的mint上不好使,简单的查看一下deepin上驱动及软件.安装上就行了. 软件及驱动 ii hpijs-ppds 3.18.12+dfsg0-2 all H ...
- 关于CSDN获取博客内容接口的x-ca-signature签名算法研究
前言 源码下载 不知道怎么就不通过了,这篇文章放出去几个月了,然后突然告诉我不行了,所以我打算换个平台(至少不能在一棵树吊死),垃圾审核 我最初想直接获取html博客,然后保存在本地,最后发布到别的博 ...
- 关于 python 的内存机制
先看一段代码 L = [1,2,3] dic_ = {} L2 = [] for i in L: dic_['sn'] = i L2.append(dic_) print(L2) 输出 [{'sn': ...
- 关于linux mint(nemo)添加右键菜单修改方法
前言 其实在 linux mint 桌面上右键弹出的菜单,以及在资源管理器 nemo 中右键菜单,这些都是基于 nemo,进行的操作,所以更改右键菜单也就是更改nemo的配置文件 操作 在目录 /ho ...
- js 传递路径参数到后台的转码和解码
在开发中遇到前端页面需要将一个附件的路径传递后台实现业务逻辑,但不进行编码一直报404的错误,上代码. 前端编码:JavaScript函数encodeURL() 说明:1 .encodeURL函数主要 ...