fluttercommunity / flutter_launcher_icons

Flutter Launcher Icons - A package 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. Maintainer: @MarkOSullivan94
https://pub.dev/packages/flutter_launcher_icons
MIT License
1.96k stars 388 forks source link

[FEATURE REQUEST][POSSIBLE BUG] Flavors - Ability to Specify Android and iOS Output Path as well as Image Name #443

Open GrahamDi opened 1 year ago

GrahamDi commented 1 year ago

:speech_balloon: Description

In my implementation of flavors (which I doubt is unique to me), in android I have separate 'res' folders (containing the mipmap folders) for 'dev' and 'prod'.

'dev' has the following path: "<project name>/android/app/src/dev/res" in Windows. 'prod' uses the 'res' folder in 'main'.

I typically use the same launch icon name for dev and prod and my build process sorts out which 'res' folder to use for the launch icons when I build for dev or prod.

I had assumed that I would simply be able to provide the path to 'res' together with the icon name as the 'android;' or 'iOS:' attribute - in fact the README.MD suggests I can...

Android

android true: Override the default existing Flutter launcher icon for the platform specified false: Ignore making launcher icons for this platform icon/path/here.png: This will generate a new launcher icons for the platform with the name you specify, without removing the old default existing Flutter launcher icon.

However, when I try to add this as the android: attribute android: "android/app/src/dev/res/launcher_icon" I get the following error message:

✗ ERROR: InvalidAndroidIconNameException The icon name must contain only lowercase a-z, 0-9, or underscore: E.g. "ic_my_new_icon" pub finished with exit code 2

It even gives this error if I add the '.png' to just the icon name, which is at odds with what your README.MD states above.

Am I doing something wrong i.e. should it work, is it a bug, or is it a missing feature? If it is the former then I would ask that the READ.ME be updated to show an example of using the path in the android and iOS attributes, and also to not say that '.png' can be used in the ican name.

Thanks a lot.

:question: Platform

I would suggest it is applied to all platforms, however, selfishly I only need it for Android ans iOS. :-)

fico45 commented 1 year ago

After almost a day worth of trying to make exactly this work, I stumbled across this issue. I'm having exactly the same issue. This makes it impossible to automate the flavored app icon generating script, thus commenting here to raise awarness.

I'm not entirely sure on how to proceed with this given the examples provided will override the main/res folder, no matter which path is provided in the android attribute. Same as for OP, Android/iOS are mainly require.

fico45 commented 1 year ago

I think it's worth updating this thread:

@GrahamDi in case you didn't find a working solution, it would seem this tutorial indeed covers it: https://dev.to/stack-labs/flutter-flavors-launcher-icons-made-simple-336j Creating separate yaml files for each flavor indeed updates each folder respectively. They should be named: flutter_launcher_icons-FLAVOR.yaml And run each one by calling flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons* The documentation should be updated to cover this. That being said, I'm also tagging @MarkOSullivan94. :)

Petri-Oosthuizen commented 1 year ago

Have you tried adding the flavor yml files to a folder? The command, dart run flutter_launcher_icons -f "flutter_launcher_icons/flutter_launcher_icons*", does not generate icons in each folder respectively. It chooses one of the files and uses it as the default.