如何更改 Flutter 上的应用程序启动器图标? [英] How to change the application launcher icon on Flutter?
问题描述
当我使用 flutter create
命令创建应用程序时,flutter 徽标用作两个平台的应用程序图标.
When I create an app with a flutter create
command, the flutter logo is used as an application icon for both platforms.
如果我想更改应用程序图标,我应该去两个平台目录并替换那里的图像吗?,平台目录我的意思是 myapp/ios/Runner/Assets.xcassets/AppIcon.appiconset
适用于 iOS,myapp/android/app/src/main/res
适用于 Android.
If I want to change the app icon, shall I go to both platforms directories and replace images there?, by platforms directories I mean myapp/ios/Runner/Assets.xcassets/AppIcon.appiconset
for iOS and myapp/android/app/src/main/res
for Android.
或者是否可以将图像定义为 Flutter Asset 并生成图标不知何故?.
Or is it possible to define an image as a Flutter Asset and the icons are generated somehow?.
推荐答案
Flutter Launcher Icons 旨在帮助快速生成适用于 Android 和 iOS 的启动器图标:https://pub.dartlang.org/packages/flutter_launcher_icons
Flutter Launcher Icons has been designed to help quickly generate launcher icons for both Android and iOS: https://pub.dartlang.org/packages/flutter_launcher_icons
- 将包添加到您的 pubspec.yaml 文件(在您的 Flutter 项目中)以使用它
- 在 pubspec.yaml 文件中指定要用于应用的图标的路径,然后选择是要为 iOS 应用、Android 应用还是两者都使用该图标.
- 运行包
- 瞧!默认启动器图标现已替换为您的自定义图标
我希望在 GitHub README 中添加一个视频来演示它
I'm hoping to add a video to the GitHub README to demonstrate it
可以在此处找到演示如何运行该工具的视频.
Video showing how to run the tool can be found here.
如果有人想提出改进建议/报告错误,请将其作为问题添加到 GitHub 项目.
If anyone wants to suggest improvements / report bugs, please add it as an issue on the GitHub project.
更新:自 2018 年 1 月 24 日星期三起,您应该能够在不覆盖 Flutter 项目中现有的旧启动器图标的情况下创建新图标.
Update: As of Wednesday 24th January 2018, you should be able to create new icons without overriding the old existing launcher icons in your Flutter project.
更新 2:从 v0.4.0(2018 年 6 月 8 日)开始,您可以为您的 Android 图标指定一个图像,为您的 iOS 图标指定一个单独的图像.
Update 2: As of v0.4.0 (8th June 2018) you can specify one image for your Android icon and a separate image for your iOS icon.
更新 3:从 v0.5.2(2018 年 6 月 20 日)开始,您现在可以为 Flutter 项目的 Android 应用添加自适应启动器图标
Update 3: As of v0.5.2 (20th June 2018) you can now add adaptive launcher icons for the Android app of your Flutter project
这篇关于如何更改 Flutter 上的应用程序启动器图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!