Git Product home page Git Product logo

Comments (5)

korzonkiee avatar korzonkiee commented on May 17, 2024 2

Hey!

I think a have an idea for a potential solution that might solve that problem.

We could:

  1. Extend FlutterGen with an additional package parameter, so that the user can define it as follows:
flutter_gen:
  output: lib/generated/
  package: my_ui_package
  lineLength: 80
  integrations:
    flutter_svg: true
  1. Modify _assetGenImageClassDefinition so that it takes package parameter. It would require transforming this constant string value into a parameterized function.
  2. Pass the package parameter to the AssetImage.super(assetName, package) super constructor.

Additionally, SVG integration would need to be updated as follows:

  1. Convert Integration.classOutput getter to method with package argument.
  2. Pass package as a default value for SvgPicture.package field.

Let me know what you think about that solution @wasabeef @jorgecoca

from flutter_gen.

orestesgaolin avatar orestesgaolin commented on May 17, 2024 1

I saw that this landed in 3.1.1 but somehow my assets aren't generated with package parameter:

Edit: I had installed fluttergen both through brew and pub, older version was overtaking the new one. Fixed by removing one from brew.

from flutter_gen.

wasabeef avatar wasabeef commented on May 17, 2024

I'm also thinking about the best way.
If anyone has a good idea, it would be helpful if you could get a pull request.

from flutter_gen.

wasabeef avatar wasabeef commented on May 17, 2024

Thanks

from flutter_gen.

om-ha avatar om-ha commented on May 17, 2024

Hey @jorgecoca

As an app developer following this issue's approach, we want to consume the package's assets. Do we have to set every single image asset as an entry in the consumer app's pubspec.yaml file? I hope there's a way to overcome this otherwise it would be too verbose.

See this article -> Example 1: shrine_images -> How an app developer uses the package.

from flutter_gen.

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.