在抖动中使用image.asset时图像质量下降 [英] Images loose quality when using image.asset in flutter

查看:92
本文介绍了在抖动中使用image.asset时图像质量下降的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用户Image.asset用于png,但已指出图像质量松散,
如何在实际设备中保持相同的质量。

I have user Image.asset for a png, but have remarked that image loose quality, how to preserve same quality in real devices.

预先感谢。

推荐答案

在我看来,这个问题

一方面,您必须在资产文件夹中指定不同的分辨率。

On the one hand, you have to specify the different resolutions in the assets folder.

assets/my_icon.png
assets/2.0x/my_icon.png
assets/3.0x/my_icon.png

另一方面,您必须在 pubspec.yaml 文件中声明这些变体。

On the other hand, you have to declare these variants in the pubspec.yaml file.

flutter:
  assets:
    - assets/
    - assets/2.0x/
    - assets/3.0x/

Flutter文档

提示:如果您从其他程序导出图像(Adobe XD for例如),您可以使用 image_res包使该任务自动化。。 em>

TIP: If you export the images from another program (Adobe XD for example), you can automate this task with the image_res package.

这篇关于在抖动中使用image.asset时图像质量下降的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆