vijaycreations
Published in

vijaycreations

Dynamically change app launcher icon in flutter

In this article we will discuss about how to dynamically change multiple app launcher icons during run-time in our flutter apps.

Add the following dependency in the pubspec.yaml file.

Consider we have the basic UI (containing the images and elevated button widgets) ready.

Now we need to write the logic for changing the app launcher icon, inside the onpress event [changeAppIcon{}] of the elevated button widget.

With this we completed the coding part for configuring the dynamic app icons.

Now to get the feature working, we need to add some changes in info.plist file which is present inside the projectโ€™s ios folder.

Therefore we need to open the project in xCode by right clicking on the ios folder.

โš ๏ธ (Note: this feature targets iOS platforms, so we need a macOS device to set it up).

After opening the project in xCode, try adding the app icon images inside the Runner/Runner folder as shown below.๐Ÿ‘‡

Next we need to set the info.plist file (follow the steps given below).

๐Ÿ‘‰ Add Icon files (iOS 5) to the Information Property List.

๐Ÿ‘‰ Add CFBundleAlternateIcons as a dictionary, inside the icon files(ios 5) created above.

๐Ÿ‘‰ Create 3 dictionaries under CFBundleAlternateIcons, with the name similar to the icon images file name (in our case it is icon1, icon2 and icon3)

๐Ÿ‘‰ For each dictionary (icon1, icon2 and icon3), two properties โ€” UIPrerenderedIcon and CFBundleIconFiles need to be created.

๐Ÿ‘‰ Finally change the CFBundleIconFiles into and an array and add item0 with the value as icon1, icon2 and icon3 for respective dictionaries.

Now run the cmds,

flutter cleanflutter pub get

Well thatโ€™s it. ๐ŸŽ‰ Run the code to see it in action.๐Ÿฅณ

Refer my video tutorial for complete guide:๐Ÿ‘‰ https://www.youtube.com/watch?v=412lSuyUJ_4

Get the complete source code here:๐Ÿ‘‰ https://github.com/vijayinyoutube/dynamic_app_icon_app

๐Ÿ”ตSetting up your Flutter app for publishing in Play Store.

๐ŸŸคAsync Programming in Dart

๐ŸŸกScratch Card in Flutter

๐Ÿ”ดConfetti Animation in Flutter

๐ŸŸข Google Fonts in Flutter app

๐Ÿ”ด Image Picker in Flutter

๐ŸŸก Change App Launcher Icon in Flutter

๐ŸŸค Neon Lighting in Flutter

๐Ÿ”ต Image Filter in Flutter

๐ŸŸฃ Enabling Flutter Web

๐ŸŸ  Animated Icons in Flutter

๐ŸŸข Best VSCode Extensions

๐Ÿ”ด AnimatedContainer Widget in Flutter

๐ŸŸก GradientText in Flutter

๐ŸŸค Custom Clipper in Flutter

๐Ÿ”ต Carousel Slider in Flutter

๐ŸŸฃ Flutter BLoC Pattern

If you found this article useful and wish to support my work, you can consider buying me a โ˜•๏ธ coffee.๐Ÿ‘‡

If you want to know more about Flutter and various Widgets in Flutterโ€ฆ?๐Ÿค“ Then visit my channel ๐Ÿ‘‰๐Ÿป vijaycreations๐Ÿšฉ

Thanks.,

--

--

A list of Flutter Tutorials and app templates

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vijay R

Hai๐Ÿ‘‹ Iโ€™m a flutter developer experienced in designing and developing stunning mobile apps. Reach out for freelance projects: vijaycreations02@gmail.com