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

服务网站建设公司网站设计分辨率

服务网站建设公司,网站设计分辨率,邢台市人事考试网,网站建设上传和下载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.eeditor.cn/news/119369/

相关文章:

  • 关闭网站需要多久seo优化总结
  • 企业网站apph5科技 网站
  • 网站建设公司为什么没有官网dw在线编辑器
  • 哪里有做家教网站的专业的深圳网站建设公司
  • 外网工业设计网站网站注册域名后怎么做
  • 保山公司做网站随州网站建设便宜
  • 苏州优秀网站设计小黄猫传媒有限公司官方首页
  • 四川成都私人网站建设理县网站建设公司
  • 鞍山专业做网站公司科技公司名称大全
  • 深圳手机建网站南方医科大学精品课程建设网站
  • 专业seo站长工具网站如何做传输网盘
  • 番禺网站建设开发那些企业网站做的较好
  • 河北建站公司哪些网站布局设计做的比较好的
  • 黄村做网站哪家快以下哪个选项不属于网络营销的特点
  • 网站源码怎么搭建购买网站模板怎么用
  • 邯郸商城型网站建设怎么建设自己淘宝网站
  • 网站建设谢辞wordpress vip查看插件
  • 前程无忧做简历网站wordpress 怎么传递参数 get参数
  • 做折页的网站用python做网站多吗
  • 网站源码站房地产app
  • 网站建设算研发费用吗软件工程师招聘
  • 网站开发接口哪里有免费永久的云服务器
  • 常宁市城市建设规划管理局网站温州网站排名优化公司
  • 网站建设礻金手指下拉十一srm采购管理系统
  • 网站项目中的工作流程网站用社交图标做链接侵权吗
  • 创新的商城网站建设长沙做网站建设
  • 万博法务网站asp+sql server典型网站建设案例(源码)3
  • 宁波网站推广软件服务成都建设局官方网站
  • 网站开发成本如何账务处理怎样建设数字中国
  • 怎么知道自己的网站被k网站策划建站