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.的更多相关文章

  1. myeclipse报错:Could not create the view: An unexpected exception was thrown.

    打开server窗口,发现显示:Could not create the view: An unexpected exception was thrown. 此处解决方法: 关闭myeclipse 删 ...

  2. MyEclipse无法创建servers视图:Could not create the view: An unexpected exception was thrown

    今天上班刚打开MyEclipse,就发现servers视图无法打开了,显示:Could not create the view: An unexpected exception was thrown. ...

  3. (转)Could not create the view: An unexpected exception was thrown. 电脑突然断电,myeclipse非正常关闭,出现错误

    问题:电脑突然断电,myeclipse非正常关闭,“Package Explorer”非正常显示,出现错误“Could not create the view: An unexpected excep ...

  4. Could not create the view: An unexpected exception was thrown 异常处理

    MyEclipse 打开后有时候莫名的在server窗口里抛出"Could not create the view: An unexpected exception was thrown&q ...

  5. Could not create the view: An unexpected exception was thrown. 电脑突然断电,myeclipse非正常关闭,出现错误

    电脑突然断电,myeclipse非正常关闭,“Package Explorer”非正常显示,出现错误“Could not create the view: An unexpected exceptio ...

  6. MyEclipse server窗口 Could not create the view: An unexpected exception was thrown 错误解决

    MyEclipse 打开后有时候莫名的在server窗口里抛出“Could not create the view: An unexpected exception was thrown”错误,解决办 ...

  7. 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. ...

  8. Could not create the view: An unexpected exception was thrown的解决方法

    MyEclipse下面的server窗口突然不能正常显示了,而且还显示Could not create the view: An unexpected exception was thrown(无法创 ...

  9. MyEclipse Could not create the view: An unexpected exception was thrown解决方案

    问题:电脑突然断电,myeclipse非正常关闭,“Package Explorer”非正常显示,出现错误“Could not create the view: An unexpected excep ...

  10. 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 ...

随机推荐

  1. k8s健康检查报错

    编辑yaml去掉健康检查 kubectl edit deployment deploymentname 服务恢复

  2. CVE-2021-44832 log4j_2.17.0 RCE复现与吐槽

    先说一句,这傻x洞能给cve就离谱,大半夜给人喊起来浪费时间看了一个小时. 先说利用条件: 需要加载"特定"的配置文件信息,或者说实际利用中需要能够修改配置文件(你都能替换配置文件 ...

  3. 最全iOS 上架指南

    一.上架基本需求资料 1.苹果开发者账号(公司已有可以不用申请,需要开通开发者功能,每年 99 美元) 2.开发好的APP 二.证书 上架版本需要使用正式的证书 1.创建证书 Apple Develo ...

  4. Day1:Markdown文本基础操作

    Markdown学习 标题 一级标题 输入:#+空格+标题名字 :快捷键(Ctrl+1~6) 二级标题 输入:##+空格+标题名字 为二级标题 依次加#(最多六级标题) 三级标题 四级标题 字体 He ...

  5. jmeter——JSON提取器(从上一个请求的响应结果提取参数传给下一个请求)

    记录一个参数提取过程,可供后续参考. 1. 查看响应报文的结构 将上一个请求的响应报文复制到Notepad++编辑器 JSON Viewer是Notepad++的JSON插件, Notepad++的P ...

  6. 单节点部署 gpmall 商城

    个人名片: 对人间的热爱与歌颂,可抵岁月冗长 Github‍:念舒_C.ying CSDN主页️:念舒_C.ying 个人博客 :念舒_C.ying 1 修改主机名: [root@localhost ...

  7. 【DL论文精读笔记】Image Segmentation Using Deep Learning: A Survey 图像分割综述

    深度学习图像分割综述 Image Segmentation Using Deep Learning: A Survey 原文连接:https://arxiv.org/pdf/2001.05566.pd ...

  8. win 10玩魔兽争霸/黑边,不能全屏,闪退

    1.win键+s键搜索注册表 打开 找到路径 计算机\HKEY_CURRENT_USER\SOFTWARE\Blizzard Entertainment\Warcraft III\Video 这里有两 ...

  9. C# DataTable 虚拟Sql临时表,可以做一些处理

    /// <summary> /// 获取临时表-和数据库表一样的的表结构的才可以 /// </summary> /// <param name="SourceT ...

  10. Linux创建定时删除日志任务

    定时删除3天前的所有日志文件: 1.例:脚本对应的要删除的目录为/home/logs在home目录创建文件clearLogFiles.sh:cd /homevim clearLogFiles.sh写入 ...