/custom_app_logo

Primary LanguageKotlinMIT LicenseMIT

custom_app_logo

Introduction

what is cutom_app_logo ?

this package handles changing app logo (currently android) dynamically from the app it self

why custom_app_loco ?

if your app requires changing app logo dynamically within the app for certain cases , this package will do the trick .

Installation

dependencies:
custom_app_logo: [latest-version]

setup and usage

  1. add your xml icon to the android/main/res/ ... folder
  2. add a new <activity-alias/>
  3. 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"/>

  1. call the function
await _customAppLogoPlugin.getActivities();

this will retrun a List<ActivtiyModel>.

  1. 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

Example