如何更改Flutter上的应用程序启动器图标? [英] How to change the application launcher icon on Flutter?

查看:163
本文介绍了如何更改Flutter上的应用程序启动器图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用flutter create命令创建应用程序时,颤抖徽标将用作两个平台的应用程序图标.

When I create an app with a flutter create command, the flutter logo is used as an application icon for both platforms.

如果我想更改应用程序图标,我是否要同时进入两个平台目录并替换图像?,按平台目录,我的意思是iOS的myapp/ios/Runner/Assets.xcassets/AppIcon.appiconset和Android的myapp/android/app/src/main/res.

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资产并生成图标不知何故?.

Or is it possible to define an image as a Flutter Asset and the icons are generated somehow?.

推荐答案

Flutter启动器图标旨在帮助快速为Android和iOS生成启动器图标:

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应用程序或两者.
  • 运行程序包
  • Voila!默认启动器图标现已替换为您的自定义图标

我希望将视频添加到GitHub自述文件中以进行演示

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屋!

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