Aus öffentlichen Paketdaten erstellte Orientierung.
Ein Flutter-Paket, das den Prozess der Aktualisierung des App-Launcher-Icons auf mehreren Plattformen vereinfacht. Es automatisiert die Erstellung und Platzierung von Icons für Android, iOS, macOS, Windows und Linux und sorgt für eine konsistente Markenidentität ohne manuelle Konfiguration. Durch die Definition von Icon-Einstellungen in einer einzigen Konfigurationsdatei sparen Entwickler Zeit und reduzieren Fehler während des Build-Prozesses. Das Paket integriert sich nahtlos in Flutter-Arbeitsabläufe und unterstützt benutzerdefinierte Icon-Größen und Asset-Verzeichnisse.
Anwendungsfälle
Automatisierung der Iconerzeugung für Multiplattform-Apps
App-Ikonen während CI/CD-Pipelines aktualisieren
Konsistente Markenbildung über Geräte hinweg aufrechterhalten
Einfachere Onboarding-Prozesse für neue Teammitglieder
Reduzierung manueller Build-Konfigurationsfehler
Hauptmerkmale
Unterstützt Android, iOS, macOS, Windows und Linux
Automatisierte Erzeugung von Symbolen aus einer einzigen Quelle
Anpassbare Symbolgrößen und Asset-Pfade
Integration in den Flutter-Build-Prozess
Konfigurierbar über pubspec.yaml
Geeignet für
Plattformübergreifende Flutter-Entwickler
Teams, die CI/CD-Workflows verwenden
App-Entwickler, die Markenkonsistenz priorisieren
Anfänger lernen die Anpassung von Flutter-Apps
Projekte, die häufige Icon-Updates erfordern
Hinweise
Erfordert korrekte Icon-Quelldateien
Kann mit bestehenden Icon-Konfigurationen kollidieren
Nicht kompatibel mit allen Drittanbieter-Build-Tools
Benötigt korrekte Berechtigungen für plattformspezifische Verzeichnisse
Manuelle Überprüfung nach der Automatisierung empfohlen
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
Flutter Launcher Icons
A command-line tool which simplifies the task of updating your Flutter app's launcher icon. Fully flexible, allowing you to choose what platform you wish to update the launcher icon for and if you want, the option to keep your old launcher icon in case you want to revert back sometime in the future.
:book: Guide
1. Setup the config file
Run the following command to create a new config automatically:
dart run flutter_launcher_icons:generate
This will create a new file called flutter_launcher_icons.yaml in your flutter project's root directory.
If you want to override the default location or name of the config file, use the -f flag:
dart run flutter_launcher_icons:generate -f <your config file name here>
To override an existing config file, use the -o flag:
dart run flutter_launcher_icons:generate -o
OR
Add your Flutter Launcher Icons configuration to your pubspec.yaml.
An example is shown below. More complex examples can be found in the example projects.
After setting up the configuration, all that is left to do is run the package.
flutter pub get
dart run flutter_launcher_icons
If you name your configuration file something other than flutter_launcher_icons.yaml or pubspec.yaml you will need to specify
the name of the file when running the package.
flutter pub get
dart run flutter_launcher_icons -f <your config file name here>
Note: If you are not using the existing pubspec.yaml ensure that your config file is located in the same directory as it.
In the above configuration, the package is setup to replace the existing launcher icons in both the Android and iOS project
with the icon located in the image path specified above and given the name "launcher_icon" in the Android project and "Example-Icon" in the iOS project.
:mag: Attributes
Shown below is the full list of attributes which you can specify within your Flutter Launcher Icons configuration.
Global
image_path: The location of the icon image file which you want to use as the app launcher icon.
Android
android
true: Override the default existing Flutter launcher icon for the platform specified
false: Ignore making launcher icons for this platform
icon/path/here.png: This will generate a new launcher icons for the platform with the name you specify, without removing the old default existing Flutter launcher icon.
image_path_android: The location of the icon image file specific for Android platform (optional - if not defined then the image_path is used)
min_sdk_android: Specify android min sdk value
The next two attributes are only used when generating Android launcher icon
adaptive_icon_background: The color (E.g. "#ffffff") or image asset (E.g. "assets/images/christmas-background.png") which will
be used to fill out the background of the adaptive icon.
adaptive_icon_foreground: The image asset which will be used for the icon foreground of the adaptive icon
Note: Adaptive Icons will only be generated when both adaptive_icon_background and adaptive_icon_foreground are specified. (the image_path is not automatically taken as foreground)
adaptive_icon_foreground_inset: This is used to add padding (in %) to the foreground icon when generating an adaptive icon. The default value is 16.
adaptive_icon_monochrome: The image asset which will be used for the icon
foreground of the Android 13+ themed icon. For more information see Android Adaptive Icons
IOS
ios
true: Override the default existing Flutter launcher icon for the platform specified
false: Ignore making launcher icons for this platform
icon/path/here.png: This will generate a new launcher icons for the platform with the name you specify, without removing the old default existing Flutter launcher icon.
image_path_ios: The location of the icon image file specific for iOS platform (optional - if not defined then the image_path is used)
remove_alpha_ios: Removes alpha channel for IOS icons
image_path_ios_dark_transparent: The location of the dark mode icon image file specific for iOS 18+ platform. Note: Apple recommends this icon to be transparent. For more information see Apple Human Interface Guidelines for App Icons
image_path_ios_tinted_grayscale: The location of the tinted mode icon image file specific for iOS 18+ platform. Note: This icon should be an grayscale image. Use desaturate_tinted_to_grayscale_ios: true to automatically desaturate the image provided here.
desaturate_tinted_to_grayscale_ios: Automatically desaturates tinted mode icon image to grayscale, defaults to false
background_color_ios: The color (in the format "#RRGGBB") to be used as the background when removing the alpha channel. It is used only when the remove_alpha_ios property is set to true. (optional - if not defined then #ffffff is used)
Web
web: Add web related configs
generate: Specifies whether to generate icons for this platform or not
image_path: Path to web icon.png
background_color: Updates background_color in web/manifest.json
theme_color: Updates theme_color in web/manifest.json
Windows
windows: Add Windows related configs
generate: Specifies whether to generate icons for Windows platform or not
image_path: Path to windows icon.png
icon_size: Windows app icon size. Icon size should be within this constrains 48<=icon_size<=256, defaults to 48
MacOS
macos: Add MacOS related configs
generate: Specifies whether to generate icons for MacOS platform or not
Create a Flutter Launcher Icons configuration file for your flavor. The config file is called flutter_launcher_icons-<flavor>.yaml by replacing <flavor> by the name of your desired flavor.
You may receive a message similar to the following
Because flutter_launcher_icons >=0.9.0 depends on args 2.0.0 and flutter_native_splash 1.2.0 depends on args ^2.1.1, flutter_launcher_icons >=0.9.0 is incompatible with flutter_native_splash 1.2.0.
And because no versions of flutter_native_splash match >1.2.0 <2.0.0, flutter_launcher_icons >=0.9.0 is incompatible with flutter_native_splash ^1.2.0.
So, because enstack depends on both flutter_native_splash ^1.2.0 and flutter_launcher_icons ^0.9.0, version solving failed.
pub get failed (1; So, because enstack depends on both flutter_native_splash ^1.2.0 and flutter_launcher_icons ^0.9.0, version solving failed.)
For a quick fix, you can temporarily override all references to a dependency: See here for an example.
:eyes: Example
Note: This is showing a very old version (v0.0.5)
Special thanks
Thanks to Brendan Duncan for the underlying image package to transform the icons.
Big thank you to all the contributors to the project. Every PR / reported issue is greatly appreciated!