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

如果我想改变应用程序的图标,我是否应该去两个平台的目录并替换那里的图像?我说的平台目录是myapp/ios/Runner/Assets.xcassets/AppIcon。apppiconset用于iOS, myapp/android/app/src/main/res用于android。

或者可以将图像定义为颤振资产和图标以某种方式生成?


当前回答

上面许多答案中推荐的flutter_launcher_icons包现在已经有一段时间没有更新了,并且正在抛出一个未捕获的异常。

你也可以使用icons_launcher包。

更新pubspec.yaml

dev_dependencies:
  icons_launcher: ^1.1.7

flutter_icons:
  image_path: 'assets/ic_logo_border.png'
  ios: true
  android: true

运行包

flutter pub get
flutter pub run icons_launcher:main

其他回答

我建议你使用下面链接的这个网站

应用图标创造者

步骤1:上传图片

步骤2:做必要的修改,然后点击下载(不要更改文件名)

步骤3:解压下载的Zip文件在相应的文件夹

android/app/src/main/res

flutter_launcher_icons: ^ 0.11.0

将此添加到你的pubspec中。yaml文件

dev_dependencies:
  flutter_launcher_icons: "^0.11.0"

flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/icon/icon.png"
  min_sdk_android: 21 # android min sdk min:16, default 21
  # optionally, as transparency is not allowed on app store
  # remove_alpha_ios: true

添加后,运行以下命令

$颤振酒吧得到

$ flutter pub运行flutter_launcher_icons:main

您必须将Flutter图标文件替换为您自己的图像。这个网站将帮助你把你的png转换成各种大小的启动器图标:

https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html

上面许多答案中推荐的flutter_launcher_icons包现在已经有一段时间没有更新了,并且正在抛出一个未捕获的异常。

你也可以使用icons_launcher包。

更新pubspec.yaml

dev_dependencies:
  icons_launcher: ^1.1.7

flutter_icons:
  image_path: 'assets/ic_logo_border.png'
  ios: true
  android: true

运行包

flutter pub get
flutter pub run icons_launcher:main

试试IconKitchen吧,它是Android Asset Studio的继承者,是为Android、iOS和网页制作高度自定义应用图标的绝佳新方法。