Aus öffentlichen Paketdaten erstellte Orientierung.
Das Paket variable_app_icon ermöglicht Entwicklern die dynamische Änderung des App-Icons auf Android und iOS. Es erlaubt Benutzern, zur Laufzeit zwischen mehreren Icons zu wechseln, was Personalisierung und Markenflexibilität erhöht. Dies ist besonders nützlich für Apps, die verschiedene Themen, Ereignisse oder Nutzerpräferenzen über ihr Icon widerspiegeln möchten. Der Plugin lässt sich nahtlos in Flutter-Projekte integrieren und unterstützt plattformspezifische Icon-Konfigurationen. Er erfordert minimale Einrichtung und funktioniert mit standardmäßigen Ressourcenmanagement-Praktiken.
Anwendungsfälle
Dynamisches Wechseln von Symbolen basierend auf Benutzereinstellungen
Thema-App-Icons für besondere Ereignisse
Branding-Anpassung in Multi-Tenant-Anwendungen
Personalisierte App-Erlebnisse
Icon-Änderungen während des App-Lebenszyklus
Hauptmerkmale
Unterstützt Android und iOS
Laufzeit-Symbolwechsel
Einfache Integration mit Flutter
Mehrfachsymbolunterstützung
plattformspezifische Konfiguration
Geeignet für
Apps, die eine Icon-Personalisierung benötigen
ereignisbasierte oder saisonale App-Themen
Marken-Apps
benutzerzentrierte Design-Apps
Entwickler, die sowohl für iOS als auch für Android targeten
Hinweise
Benötigt manuelle Einrichtung von Symbolressourcen
Beschränkt auf unterstützte Plattformen
Möglicherweise sind zusätzliche Build-Schritte erforderlich
Aufgrund politischer Beschränkungen nicht für alle App-Stores geeignet
Icon-Änderungen können sich auf einigen Geräten möglicherweise nicht sofort widerspiegeln
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
variable_app_icon
A plugin to use multiple app icon on Android and iOS.
If you don't know yet, you can use multiple app icon in an iOS app from 10.3. in android, you can do this using activity-alias. You can accomplish
this in your flutter app by using this plugin
Getting Started
First, add variable_app_icon as a dependency in your pubspec.yaml file.
dependencies:variable_app_icon:^0.0.1
Don't forget to flutter pub get.
Usage
1. Setting the app icons (Android)
Drop your app icons into mipmap folders. Then configure android/app/src/main/AndroidManifest.xml as follows.
Why this layout? Activity-aliases are how Android serves multiple launcher icons from one APK, but two known issues require extra care:
Flutter's tooling does not properly follow <activity-alias> for flutter run (flutter/flutter#38965). To make flutter run work, MainActivity must declare android:exported="true" (Android 12+ rule, since it is reachable from adb shell am start) and carry a MAIN + LAUNCHER intent-filter in the source manifest. The LAUNCHER category is then stripped at merge time via tools:node="remove" so MainActivity does not appear as a duplicate launcher icon next to the aliases at runtime.
Some OEM launchers (e.g. Huawei) read app metadata from <application> for the uninstall prompt and system dialogs — see issue #5. Keep android:icon and android:label on <application>.
Use this template (replace your_app_name / mipmap names / activity-alias ids as needed):
<manifestxmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"><applicationandroid:name="${applicationName}"android:icon="@mipmap/ic_launcher"android:label="your_app_name"><!-- One activity-alias per selectable icon. The id (android:name) must contain at least one dot. --><activity-aliasandroid:name="appicon.DEFAULT"android:enabled="true"android:exported="true"android:icon="@mipmap/ic_launcher"android:label="your_app_name"android:targetActivity=".MainActivity"><intent-filter><actionandroid:name="android.intent.action.MAIN" /><categoryandroid:name="android.intent.category.LAUNCHER" /></intent-filter></activity-alias><!-- Repeat <activity-alias> for each additional icon, with android:enabled="false". --><activityandroid:name=".MainActivity"android:exported="true"android:launchMode="singleTop"android:taskAffinity=""android:theme="@style/LaunchTheme"android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"android:hardwareAccelerated="true"android:windowSoftInputMode="adjustResize"><meta-dataandroid:name="io.flutter.embedding.android.NormalTheme"android:resource="@style/NormalTheme" /><!-- This intent-filter makes `flutter run` work with the activity-alias setup
(flutter/flutter#38965). Flutter's launchable-activity detection reads the
source manifest and needs MainActivity to declare MAIN + LAUNCHER; without
it, `flutter run` cannot locate MainActivity as launchable. If LAUNCHER
survived to runtime, however, MainActivity would appear as a duplicate
launcher icon next to the activity-aliases. `tools:node="remove"` strips
LAUNCHER at manifest-merge time, satisfying both constraints. --><intent-filter><actionandroid:name="android.intent.action.MAIN" /><categoryandroid:name="android.intent.category.LAUNCHER"tools:node="remove" /></intent-filter></activity><meta-dataandroid:name="flutterEmbedding"android:value="2" /></application></manifest>
Notes per icon:
android:name is the icon id (must contain at least one dot — e.g. appicon.DEFAULT, appicon.TEAL). You pass this id from Dart when calling VariableAppIcon.changeAppIcon.
android:enabled="true" on the default icon's alias, android:enabled="false" on the rest.
See example/android/app/src/main/AndroidManifest.xml in this repo for a complete working example with three icons.
2. Setting the app icons (iOS)
Open your ios project i.e. Runner in Xcode, then go to Build Settings tab.
Now search icon, you will find Assets Catalog Compiler Options. Set Include All App Icon
Assets to Yes.
Then add all the icons name to the Alternate App Icon Sets.
3. From the flutter side
In main function set this two variable,
VariableAppIcon.iOSDefaultAppIcon = iosAppIcons[0]; // default ios iconVariableAppIcon.androidAppIconIds = androidIconIds; // all android icons ids, this is the android:name, you have specified in `AndroidManifest.xml` file. like, ["appicon.DEFAULT", others]