Home

Awesome

Flutter Launcher Icons

Flutter Community: flutter_launcher_icons

pub package

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.

dev_dependencies:
  flutter_launcher_icons: "^0.14.2"

flutter_launcher_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/icon/icon.png"
  min_sdk_android: 21 # android min sdk min:16, default 21
  web:
    generate: true
    image_path: "path/to/image.png"
    background_color: "#hexcode"
    theme_color: "#hexcode"
  windows:
    generate: true
    image_path: "path/to/image.png"
    icon_size: 48 # min:48, max:256, default: 48
  macos:
    generate: true
    image_path: "path/to/image.png"

2. Run the package

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.

If you encounter any issues please report them here.

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

Android

IOS

Web

Windows

MacOS

Note: iOS icons should fill the entire image and not contain transparent borders.

Flavor support

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.

The configuration file format is the same.

An example project with flavor support enabled has been added to the examples.

:question: Troubleshooting

Listed a couple common issues with solutions for them

Generated icon color is different from the original icon

Caused by an update to the image dependency which is used by Flutter Launcher Icons.

Use #AARRGGBB for colors instead of #AABBGGRR, to be compatible with Flutter image class.

Related issue

Image foreground is too big / too small

For best results try and use a foreground image which has padding much like the one in the example.

Related issue

Dependency incompatible

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

Video Example

Note: This is showing a very old version (v0.0.5)

Special thanks