App Icon Generation - tungpham6195/flutter GitHub Wiki
Refer this package
Add flutter_launcher_icons
to your pubspec.yaml
under dev_dependencies
:
dev_dependencies:
flutter_launcher_icons: <latest_version>
Then run flutter pub get
For Android 8.0 (API 26), you need to follow the adaptive icon guides: Refer this.
So you need to make sure that your icon be inside of this boundary. Use this tempate.
-
.yaml file name should be following this format
flutter_launcher_icons-<flavor>.yaml
-
flavor
: it should be exactly your flavor name, e.g:flutter_launcher_icons-dev.yaml
This is example
-
For
development
flavorflutter_icons: image_path_android: "assets/launcher_icon/android/icon_dev.png" image_path_ios: "assets/launcher_icon/ios/icon_dev.png" android: "ic_launcher" ios: true adaptive_icon_background: "#ffffff" adaptive_icon_foreground: "assets/launcher_icon/android/icon_dev.png" remove_alpha_ios: true
-
For
production
flavorflutter_icons: image_path_android: "assets/launcher_icon/android/icon_prod.png" image_path_ios: "assets/launcher_icon/ios/icon_prod.png" android: "ic_launcher" ios: true adaptive_icon_background: "#ffffff" adaptive_icon_foreground: "assets/launcher_icon/android/icon_prod.png" remove_alpha_ios: true
-
Create a script file:
generate_icon.sh
flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons-dev.yaml
You can choose 1 of those configuration files to use for generate app icon,
flutter_launcher_icons
will generate icons for all flavors if you have configuration for those flavorsE.g: I have 2 configurations for flavor
prod
anddev
, but I just run withdev
(flutter_launcher_icons-dev.yaml
),flutter_launcher_icons
also generate icons forprod