当我使用flutter create命令创建应用程序时,flutter标志将用作两个平台的应用程序图标。
如果我想改变应用程序的图标,我是否应该去两个平台的目录并替换那里的图像?我说的平台目录是myapp/ios/Runner/Assets.xcassets/AppIcon。apppiconset用于iOS, myapp/android/app/src/main/res用于android。
或者可以将图像定义为颤振资产和图标以某种方式生成?
当我使用flutter create命令创建应用程序时,flutter标志将用作两个平台的应用程序图标。
如果我想改变应用程序的图标,我是否应该去两个平台的目录并替换那里的图像?我说的平台目录是myapp/ios/Runner/Assets.xcassets/AppIcon。apppiconset用于iOS, myapp/android/app/src/main/res用于android。
或者可以将图像定义为颤振资产和图标以某种方式生成?
当前回答
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
最好的方法是分别改变iOS和Android的启动器图标。
分别修改iOS和Android模块的图标。 该插件从相同的图标产生不同大小的图标,这些图标是扭曲的。
点击这个链接: https://flutter.dev/docs/deployment/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
没有任何包装
安卓
使用Android Asset Studio在Flutter项目的根目录中创建一个自适应启动器图标。 将生成的启动器图标文件添加到项目的android/app/src/main/res/mipmap-*/目录下。 编辑android/app/src/main/AndroidManifest.xml文件,并在标签下面添加如下一行:
<应用android:图标= " @mipmap / ic_launcher”>
运行flutter build apk命令生成带有新启动器图标的apk。
iOS
使用应用程序图标生成器在Flutter项目的根目录中创建自适应应用程序图标。 将生成的应用图标文件添加到项目的ios/Runner/Assets.xcassets/AppIcon。appiconset /目录中。 编辑ios/Runner/Info. conf文件。Plist文件,并在标签下面添加以下一行:
<key>CFBundleIconName</key>
<string>AppIcon</string>
运行flutter build ios命令生成带有新启动器图标的IPA。
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