美文网首页
Flutter☞Image组件的常用属性

Flutter☞Image组件的常用属性

作者: 木易先生灬 | 来源:发表于2019-05-18 18:10 被阅读0次
          Image.network(
              'http://bizhi.bcoderss.com/wp-content/uploads/2019/05/2497_1558143281.jpg',
              // 默认不设置fit的状态:BoxFit.contain
              // 横向铺满纵向裁剪:BoxFit.cover
              // 铺满盒子,不管图片是否变形:BoxFit.fill
              // 图片纵向铺满,横向裁切:BoxFit.fitHeight
              // BoxFit.fitWidth与BoxFit.cover类似
              // 图片默认大小 BoxFit.none
              // BoxFit.scaleDown与BoxFit.fitHeight类似
              fit: BoxFit.cover,
              // 颜色叠加
              color: Colors.yellow,
              // 属性值很多,需要一个一个试
              colorBlendMode: BlendMode.color,
              // 平铺 与fit不能同时存在[除:BoxFit.contain]
              repeat: ImageRepeat.repeatX,
            ),

Image属性

资源目录(App中的目录, 打包时,会自动进行打包)

 Image.asset(路径)

安装到设备上后的本地路径

Image.file()

不太理解,类似存在内存中的图片!?

Image.memory()

最长用到的属性没有之一,网路图片路径

Image.netwoek()

图片属性

默认不设置fit的状态:BoxFit.contain

fit: BoxFit.contain,

横向铺满纵向裁剪or相反

fit: BoxFit.cover,

铺满盒子,不管图片是否变形:BoxFit.fill
图片纵向铺满,横向裁切:BoxFit.fitHeight
BoxFit.fitWidth与BoxFit.cover类似
图片默认大小 BoxFit.none
BoxFit.scaleDown与BoxFit.fitHeight类似


颜色叠加

color: Colors.yellow,

类似滤镜!? 属性值很多,需要一个一个试

colorBlendMode: BlendMode.color,

平铺 与fit不能同时存在 { 除:BoxFit.contain } (主要是不好看效果)

repeat: ImageRepeat.repeatX,
默认没有设置fit.png

相关文章

网友评论

      本文标题:Flutter☞Image组件的常用属性

      本文链接:https://www.haomeiwen.com/subject/yentzqtx.html