当我使用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_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中设置应用程序图标的最佳推荐方法。
我找到了一个插件来设置应用程序图标在flutter名为flutter_launcher_icons。我们可以使用这个插件在flutter中设置应用程序图标。
在pubspec中添加此插件。项目根目录下的Yaml文件。请检查以下代码,
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
flutter_launcher_icons: ^0.7.2+1**
保存文件并在终端上运行flutter pub get。
在项目的根文件夹资产中创建一个文件夹资产,同时创建一个文件夹图标,并将应用程序图标放在这个文件夹中。我将推荐给用户1024x1024的应用程序图标大小。我已经把应用程序图标放在图标文件夹内,现在我有应用程序图标路径为assets/icon/icon.png 现在,在pubspec中。Yaml添加下面的代码,
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icon/icon.png"
保存文件并在终端上运行flutter pub get。运行命令后,运行第二条命令,如下所示
flutter pub run flutter_launcher_icons:main -f pubspec.yaml
然后运行App
上面许多答案中推荐的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
最好的方法是分别改变iOS和Android的启动器图标。
分别修改iOS和Android模块的图标。 该插件从相同的图标产生不同大小的图标,这些图标是扭曲的。
点击这个链接: https://flutter.dev/docs/deployment/android