mark-nicepants / figma2flutter

Converts design token json files to flutter
Apache License 2.0
17 stars 16 forks source link

[BUG] Issues with inheritance #15

Closed stongef-sonepar closed 3 months ago

stongef-sonepar commented 6 months ago

See bellow

frederikstonge commented 3 months ago

Update on the problem :

We have updated our tokens to support multiple theme and it looks like they are split in different categories, color themes, and semantic themes. ITokens generates with only colors and material colors, but nothing related to semantic.

Here is a screenshot with the issue : image

This is the generated files : tokens.g.zip

And here's the tokens file : tokens.json

frederikstonge commented 3 months ago

@freemansoft I'd like your input on this.

How is ITokens generated? Is it generated with overridden properties in all themes, and ignoring those who are missing in at least 1 theme?

Would there be a way to include missing overridden properties but as nullable?

frederikstonge commented 3 months ago

Adding : "semantic": "source", in base theme selectedTokenSets seems to include the missing properties, but other issues are raised because some themes are not redefining these properties. A big refactor of how we generate code with inheritance would be required to fix this :(

ITokens should be generated with all properties, non mandatory properties should be marked as nullable, and a merge method should be exposed to merge multiple token classes.

freemansoft commented 3 months ago

Why was this bug marked completed? The last message says a bunch of work needs to be done.

frederikstonge commented 3 months ago

stongef-sonepar is actually my work account. I manage to make it work, my job is using figma studio and are creating partial themes, which is clearly not supported in flutter. I changed the definition of $themes in the tokens file and generation worked.