android - 有没有办法在颤动中使用 .svg 作为应用程序图标?
问题描述
我正在使用flutter_launcher_icons
包在颤振应用程序中设置默认应用程序图标(特别适用于android)。现在,我必须使用svg
文件作为图标,因为png
图标在通知栏中的深色主题 android 版本中显示不正确。但它显示了一些错误NoDecoderForImageFormatException
。
pubspec.yaml 文件配置:
flutter_icons:
# image_path: "assets/images/icon-128x128.png"
android: "launcher_icon"
ios: true
image_path: "assets/images/logo.svg"
这是flutter pub run flutter_launcher_icons:main
命令的输出。
pub run flutter_launcher_icons:main
════════════════════════════════════════════
FLUTTER LAUNCHER ICONS (v0.9.0)
════════════════════════════════════════════
• Creating default icons Android
✓ Successfully generated launcher icons
Unhandled exception:
✗ ERROR: NoDecoderForImageFormatException
assets/images/logo.svg
#0 decodeImageFile (package:flutter_launcher_icons/utils.dart:37:5)
#1 createDefaultIcons (package:flutter_launcher_icons/android.dart:35:24)
#2 createIconsFromConfig (package:flutter_launcher_icons/main.dart:103:5)
#3 createIconsFromArguments (package:flutter_launcher_icons/main.dart:60:7)
#4 main (file:///home/jspw/Android/Sdk/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.9.0/bin/main.dart:6:3)
#5 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:281:32)
#6 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
pub finished with exit code 255
解决方案
The package flutter_launcher_icons only uses PNG images to create all the different sizes of logos (hdpi, mdpi, xhdpi etc...)
If you have a problem with Android, did you try to use the adaptive_icon_background
and adaptive_icon_foreground
attribute?
推荐阅读
- javascript - 在electronjs中保持窗口比率
- entity-framework - Dapper 查询时间随着并发操作而大大增加
- robotframework - 如何在机器人框架中使用 sikuli 比较两个图像
- javascript - 循环遍历两个输入的总和,直到加倍(javascript)
- c - 使用 netlink 套接字获取接口的丢弃数据包计数
- json - 对标签强制执行的自定义策略
- reactjs - 如何在 FormControlLabel 上的标签和控件之间添加填充
- python - Python:将数字列表转换为相应的字母
- android - CameraX 错误:减少使用计数的次数多于增加次数
- ruby-on-rails - Ruby 将参数从一个函数传递到另一个函数