this package handles changing app logo (currently android) dynamically from the app it self
if your app requires changing app logo dynamically within the app for certain cases , this package will do the trick .
dependencies:
custom_app_logo: [latest-version]
- add your xml icon to the android/main/res/ ... folder
- add a new
<activity-alias/>
- add your icon to the added
<activity-alias/>
<activity
android:icon="@drawable/ic_yellow"
android:name=".MainActivity"
android:enabled="true"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity-alias
android:enabled="true"
android:icon="@drawable/ic_green"
android:exported="true"
android:targetActivity=".MainActivity" android:name=".SecondActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity-alias>
Note: you should have a logo in your <activity android:name=".=MainActivity"/>
- call the function
await _customAppLogoPlugin.getActivities();
this will retrun a List<ActivtiyModel>
.
- each
ActivityModel
containse the following
class ActivityModel {
final String activtiyName;
final Uint8List activtiyLogo;
final VoidCallback onChangeActivtiyLogo;
ActivityModel({required this.activtiyName, required this.activtiyLogo, required this.onChangeActivtiyLogo});
}
so you just call the CallBack function and the logo would be changed
NOTE the IOS implementation will be add later