Giter Club home page Giter Club logo

Comments (21)

MarkOSullivan94 avatar MarkOSullivan94 commented on July 18, 2024 7

Flavor support is working in the flavor branch for projects which already have flavors setup. I'm hoping to add a separate example app which makes use of flavors before merging that branch into master.

from flutter_launcher_icons.

jorgecoca avatar jorgecoca commented on July 18, 2024 5

I have created #154 to showcase this functionality.

Can someone review the PR? 👀 @MarkOSullivan94 @slightfoot

from flutter_launcher_icons.

GregorySech avatar GregorySech commented on July 18, 2024 4

The flutter CLI supports it. It's just a pass through to gradle flavours and to iOS schemas.
I'm reproducing these articles about flavoring right now:

  • From salvatoregiordanoo at Medium : article1
  • From Natalie Masse Hooper at Cogitas : article2

I guess a good idea might be, while taking as base the readme example:

dev_dependencies: 
  flutter_test:
    sdk: flutter
    
  flutter_launcher_icons: "^0.6.1"
  
flutter_icons:
  android: true 
  ios: "Example-Icon"
  image_path: "assets/icon/icon.png"
  image_path_android: "assets/icon/icon_android.png"
  image_path_ios: "assets/icon/icon_ios.png"
  adaptive_icon_background: "#FFFAFAFA"
  adaptive_icon_foreground: "assets/icon/icon-foreground.png"
  flavors:
    <flavor-name>:
      android: true 
      ios: "<icon name>"
      image_path: "<path here>"
      image_path_android: "<path here>"
      image_path_ios: "<path here>"
      adaptive_icon_background: "<color here>"
      adaptive_icon_foreground: "<path here>"

by making the flavors node optional older configurations should be compatible with this feature.

from flutter_launcher_icons.

MarkOSullivan94 avatar MarkOSullivan94 commented on July 18, 2024 4

Flavors functionality available for now in the flavors branch thanks to @sestegra for the implementation and @jorgecoca for putting together the example project 🎉

There's currently some merge conflicts preventing it from being merged into master branch right now.

from flutter_launcher_icons.

MarkOSullivan94 avatar MarkOSullivan94 commented on July 18, 2024 2

@matthew-carroll @lifenautjoe it currently works in the flavors branch and I've also spent time trying to fix the merge conflicts between the flavors branch and master branch in the develop branch so it can be merged into master

Just want to do some more testing before merging

@lifenautjoe in the example flavors project you can run any of the following commands which will work:

flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons-production.yaml

OR 

flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons-development.yaml

OR 

flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons-integration.yaml

For every single flavor you have within your project, you should have a yaml config file for it, in the example project there's 3 flavors:

  • production
  • integration
  • development

from flutter_launcher_icons.

rockneverdies55 avatar rockneverdies55 commented on July 18, 2024 1

This would be a killer feature... @MarkOSullivan94 were you be able look into this at all?

from flutter_launcher_icons.

sestegra avatar sestegra commented on July 18, 2024 1

See my pull request.

A sample project is available at following repository:
https://github.com/sestegra/flutter_assets_flavors

from flutter_launcher_icons.

hhelmric avatar hhelmric commented on July 18, 2024 1

@jorgecoca @sestegra For a bit of clarification, is the intended functionality of this feature to automatically rebuild the app launcher icons every time the app is built?

Or do we still need to manually run this command each time we switch from one flavor to another?
flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons-${flavor_name}.yaml

from flutter_launcher_icons.

GregorySech avatar GregorySech commented on July 18, 2024

It might not be a breaking change, just adding a "flavors" node with all the flavors icons configuration might do the trick.

from flutter_launcher_icons.

MarkOSullivan94 avatar MarkOSullivan94 commented on July 18, 2024

I'm not sure I understand where you're coming from.

I did a bit of research and I've found it's possible to have a debug icon and a release icon for Android: https://stackoverflow.com/questions/22875948/how-to-provide-different-android-app-icons-for-different-gradle-buildtypes/22876224#22876224

Are you wanting something like that? Where you can specify a debug flavor?

Or are you just wanting an option to quickly switch between different flavors of launcher icons?

If you do, this is already possible, you could have your image_path and android / ios icon names all specified for the different flavours and then just comment out the ones which you don't want to use. It'll quickly switch between them for you.

from flutter_launcher_icons.

GregorySech avatar GregorySech commented on July 18, 2024

Yes I wanted something like option 1, so that running flutter build --flavor <flavor> would build the requested flavor with a different icon without having to edit the configuration and re-running flutter pub pub run flutter_launcher_icons:main. Although it's not only about debug flavoring.

from flutter_launcher_icons.

MarkOSullivan94 avatar MarkOSullivan94 commented on July 18, 2024

Unfortunately unless Flutter cmd line tools support that, you wont be able to run flutter build --flavor <flavor>.

I'll also need to look into how passing cmd line arguments will work as I haven't done that before.

Curious how you would prefer this to be setup within the pubspec.yaml config?

from flutter_launcher_icons.

MarkOSullivan94 avatar MarkOSullivan94 commented on July 18, 2024

Related: #130

Will leave this to someone else who has experience with setting up a Flutter project with flavours enabled

from flutter_launcher_icons.

jorgecoca avatar jorgecoca commented on July 18, 2024

I will add a project with flavors set today ;) If so, do you think we could get this merge soon?

from flutter_launcher_icons.

hhelmric avatar hhelmric commented on July 18, 2024

@jorgecoca @sestegra For a bit of clarification, is the intended functionality of this feature to automatically rebuild the app launcher icons every time the app is built?

Or do we still need to manually run this command each time we switch from one flavor to another?
flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons-${flavor_name}.yaml

Ok I take back my question. I had not set everything up correctly so it wasn't working as expected! Once I got everything in the right folders and with the correct names, I was able to run flutter pub get and flutter pub run flutter_launcher_icons:main and it created all of the correct launcher icon files in the android/app/src/${flavor}/res directories. The correct assets are loaded when I switch flavors and I would presume that if I update the icons or graphics, I'll need to run this command again, which should be expected anyways. Thanks!

from flutter_launcher_icons.

w3ggy avatar w3ggy commented on July 18, 2024

The sample doesn't work in such way.
I run flutter pub run flutter_launcher_icons:main
Then receive Check that your config file flutter_launcher_icons.yaml has a flutter_icons section

The command flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons-${flavor_name}.yaml generates for all flavors.

from flutter_launcher_icons.

matthew-carroll avatar matthew-carroll commented on July 18, 2024

Can anyone summarize where this issue stands? Has the functionality been abandoned? Is it blocked on a technical hurdle?

from flutter_launcher_icons.

w3ggy avatar w3ggy commented on July 18, 2024

I am using it on two projects and everything is fine.
Just a note about confusing way to generate icons for all flavors that you have to run
flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons-${flavor_name}.yaml that will generate for all flavors.

from flutter_launcher_icons.

lifenautjoe avatar lifenautjoe commented on July 18, 2024

If I get it right, we're supposed to use the branch flavors? Is there any chance that gets merged? Its already a bit behind.

from flutter_launcher_icons.

lifenautjoe avatar lifenautjoe commented on July 18, 2024

I'm trying to figure this out but the examples/flavor just contains 3 config .yaml files. What is supposed to be run to generate the flavored assets?

from flutter_launcher_icons.

gazialankus avatar gazialankus commented on July 18, 2024

FWIW, just running this is enough to handle all flavors: flutter pub run flutter_launcher_icons

In case you are wondering why it won't work for you, you may have used an underscore instead of a dash before your flavor name. So flutter_launcher_icons-production.yaml is good but flutter_launcher_icons_production.yaml is not.

from flutter_launcher_icons.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.