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 ...
随机推荐
- python关于Django搭建简单博客项目(教程)
由于csdn各种django blog博文都有或多或少的bug,所以我决定自己写一篇,先附上教程,详解在另一篇博文里,为了便于大家复制粘贴,本文代码尽量不使用图片. 源代码及解析文章请在我的githu ...
- ElasticSearch之Quick.ElasticSearch.Furion组件的使用
ElasticSearch 使用说明 本章,我们主要讲解在.Net 中对Quick.ElasticSearch.Furion的使用进行介绍! ElasticSearch 的官方客户端 API 文档地址 ...
- vulnhub靶场之CORROSION: 2
准备: 攻击机:虚拟机kali.本机win10. 靶机:CORROSION: 2,网段地址我这里设置的桥接,所以与本机电脑在同一网段,下载地址:https://download.vulnhub.com ...
- 常用类.String类
package 常用类.String;import java.util.Arrays;import java.util.Locale;public class demo01 { public stat ...
- KeeWiDB的高性能修炼之路:架构篇
数据也有冷热之分,你知道吗? 根据访问的频率的高低可将数据分为热数据和冷数据,访问频率高的则为热数据,低为冷数据.如果热.冷数据不区分,一并存储,显然不科学.将冷数据也存储在昂贵的内存中,那么你想,成 ...
- WebKit策略:<foreignObject>可用于绘制svg中的html标签,但与<use>搭配不生效
在<svg>里面可以利用<foreignObject>绘制html标签,原本是我在iconfont采用Font class方式引入svg的无奈之举. 起初的设计是所有icon先 ...
- perl reverse函数
转载至 Perl - 列表 - reverse 操作 reverse(逆转)操作将输入的一串列表(可能是数组)按相反的顺序返回. my @arr=("Head_PMA1",&qu ...
- 修改api-server支持的NodePort端口映射范围
创建svc资源报错显示:provided port is not in the valid range. The range of valid ports is 30000-32767 k8s集群默认 ...
- 不借助idea开发工具构建一个Javaweb项目
不借助idea开发工具构建一个Javaweb项目 目录结构 webappsroot |----------WEB-INF |----------classes(存放字节码) |----------li ...
- KafkaOffsetMonitor:监控消费者和延迟的队列
个人名片: 因为云计算成为了监控工程师 个人博客:念舒_C.ying CSDN主页️:念舒_C.ying 目录 消费者组列表 消费组的topic列表 图中参数含义解释如下: topic的历史位置 O ...