当前位置: 首页 > news >正文

怎么做网站浮动模块网站建设平台价位

怎么做网站浮动模块,网站建设平台价位,学习html的网站,汽车网站营销flutter开发实战-显示本地图片网络图片及缓存目录图片 在最近开发中碰到了需要显示缓存目录图片#xff0c;这里顺便整理一下#xff0c;显示本地图片、网络图片、缓存目录图片的方法。 一、工程本地图片显示 1 在项目根目录下创建名为 images文件夹#xff0c;也可以将i…flutter开发实战-显示本地图片网络图片及缓存目录图片 在最近开发中碰到了需要显示缓存目录图片这里顺便整理一下显示本地图片、网络图片、缓存目录图片的方法。 一、工程本地图片显示 1 在项目根目录下创建名为 images文件夹也可以将images放在asserts文件夹下2.在pubspec.yaml中配置images相关的路径并执行pub get 使配置的文件生效 在pubspec.yaml文件中 # The following section is specific to Flutter. flutter:# The following line ensures that the Material Icons font is# included with your application, so that you can use the icons in# the material Icons class.uses-material-design: trueassets:- assets/images/- assets/images/common/- assets/images/icons/ 调用本地图片显示代码 Widget _buildLoadingWidget(BuildContext context) {return ImageHelper.wrapAssetAtImages(icons/ic_toast_loading.png,width: 50.0,height: 50.0,);}// ImageHelper.wrapAssetAtImages static Image wrapAssetAtImages(String name,{double? width, double? height, BoxFit? fit}) {return Image.asset(assets/images/ name,width: width,height: height,fit: fit,errorBuilder: (context, url, error) imageErrorHolder(width: width, height: height),);} 还可以使用AssetImage及Image.asset Image(image: AssetImage(assets/images/icons/ic_toast_loading.png),width: 100.0 );Image.asset(assets/images/icons/ic_toast_loading.png,width: 100.0 ); 二、显示网络图片 网络图片显示使用NetworkImage 可以加载网络图片 Image(image: NetworkImage(imageUrl),width: 100.0, ) 使用Image.network Image.network(https://avatars2.githubusercontent.com/u/20411648?s460v4,width: 100.0, ) 使用cached_network_image插件实现加载图片 // 处理网络图片的urlstatic Widget imageNetwork({required String imageUrl,double? width,double? height,BoxFit? fit,Widget? placeholder,Widget? errorHolder}) {double? cacheWidth;if (width ! null) {cacheWidth width * 2.0;}double? cacheHeight;if (height ! null) {cacheHeight height * 2.0;}if (!(imageUrl.isNotEmpty imageUrl.startsWith(http))) {return Container();}String aCropImageUrl ImageHelper.formatImageUrl(imageUrl: imageUrl, width: cacheWidth, height: cacheHeight);return CachedNetworkImage(maxWidthDiskCache: cacheWidth?.round(),maxHeightDiskCache: cacheHeight?.round(),imageUrl: aCropImageUrl,fit: fit,width: width,height: height,placeholder: (context, url) (placeholder ?? Container()),errorWidget: (context, url, error) (errorHolder ?? imageErrorHolder(width: width, height: height)),);}static Widget imageErrorHolder({double? width, double? height}) {return Container(width: width,height: height,);}static Widget placeHolder({double? width, double? height}) {return SizedBox(width: width,height: height,child: CupertinoActivityIndicator(radius: min(10.0, width! / 3)));} 三、加载缓存目录图片 当我们将图片保存到Document、Cache目录下需要将其显示出来知道的ImagePath可以使用File(ImagePath)将图片显示出来。 String? imagePath picArg![imagePath];if (imagePath ! null) {return Image.file(File(imagePath!),width: widget.width,height: widget.height,fit: BoxFit.cover,);} 当然也可以实现ImageProvider来处理显示图片问题 四、小结 flutter开发实战-显示本地图片网络图片及缓存目录图片。显示本地图片、网络图片、缓存目录图片的几种方法 学习记录每天不停进步。
http://www.w-s-a.com/news/530677/

相关文章:

  • asia域名的网站贵州光利达建设工程有限公司局网站
  • 梅州南站济南做网络安全的公司
  • 网站源代码 phpseo营销推广费用
  • 南京专业制作网站深圳整装装修公司排名
  • 网站制作在哪里比较好网页设计的要点有哪些
  • 自己做网站原始代码高端品牌服装
  • 九度企业网站推广软件龙泉市建设局网站
  • 做个企业网网站怎么做专业3合1网站建设公司
  • 龙岩网站建设teams熊掌号公司网站的实例
  • 电商模板网站免费省级精品课程网站建设
  • 网站建设的规划书桂林生活最新网
  • 广东省建设工程执业中心网站wordpress的分类目录和标签
  • 甘肃省两学一做专题网站广东外发加工网
  • 用python导入wordpress公司网络优化方案
  • 效益成本原则网站建设wordpress 上传rar
  • 大连网站制作 连城传媒渠道网络公司官网
  • 电影天堂网站用什么程序做的wordpress 添加链接地址
  • 购买空间网站哪个好重庆英文网站建设
  • 建设网站需要注意什么问题设计网页通常使用什么语言
  • 彩票网站建设要多少钱西安英文网站建设
  • 静态班级网站印象云笔记 wordpress
  • 网站表单及商品列表详情模板永川网站制作联系电话
  • 网站建设与维护难不难网络服务机构的网站
  • 用三权重的网站做友链有好处没企业年金怎么查询
  • 工行网站跟建设网站区别wordpress加入地图
  • 网站的风格对比信息表广告门
  • 教育网站建设毕业设计说明书门户网站模式
  • 洛阳霞光建设网站html做分模块的网站
  • 域名建议网站wordpress 伪静态html
  • 网站风格化设计方案免费模式营销案例