mark-nicepants / figma2flutter

Converts design token json files to flutter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG]

JDDV opened this issue · comments

ℹ️ Info

Pulled version 0.1.1-alpha from GitHub.
Version on Pub.dev however is still 0.1.0-alpha (that version is used if you activate the package using dart pub global activate figma2flutter).

💬 Description

First of all, @mark-nicepants thank you for this awesome package!

I've been trying out the package but there are 2 small bugs that I've noticed.

The generated output is not correct, and I think I've found the reason for it.
In the tokens.g.dart file the generated class DefaultRadiiTokens tokens returns a const BorderRadius.zero which is not possible, since there is no const constructor for BorderRadius.zero. The same goes for DefaultSpacingTokens, where a const EdgeInsets.zero can be returned, which is not possible either since there is no const constructor for EdgeInsets.zero.

I tried to make a PR, but I have no permissions it said when I tried to push the PR. I noticed how ever that the bug for the DefaultSpacingTokens class is fixed in version 0.1.1-alpha, but because the version 0.1.0-alpha is being used (that's the version on pub.dev) the files still generate the wrong output.

I fixed those little bugs locally on my machine, but another error came to light when I did that. I tried to activate the local package by using dart pub global activate --source path <local dir>, so I am able to run the figma2flutter --input <input json> --output <output dir> with the fixed bugs. This however did not work because the paths are hardcoded in version 0.1.1-alpha in the figma2flutter.dart file, instead of using the values from the parameters.

Edit: I missed the commented lines above the part were the paths were hardcoded, so locally on my machine I uncommented the variables that take the values supplied for the input and output parameters, and commented the hardcoded lines and that worked!

Summary / TL;DR:

  • DefaultRadiiTokens class still contains a const BorderRadius.zero which will not work.
  • Version on pub.dev is behind (0.1.0-alpha is being used, instead of 0.1.1-alpha).
  • figma2flutter --input --output does not work in version 0.1.1-alpha due to hardcoded values in the figma2flutter.dart file.

📜 tokens file you tried to import

Not applicable

It looks like someone merged a PR for the const BorderRadius.zero

Sorry for the delay. I pushed a new update to pub.dev with these bugs all fixed.

No worries! Keep up the good work!