mark-nicepants / figma2flutter

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

handle additional trailing ; #39

Closed apackin closed 3 hours ago

apackin commented 1 week ago

PR Description

Fixes Issue: Incorrect Parsing of Linear Gradients with Trailing Semicolons

Issue

Some of the linear-gradient values in our JSON contain a trailing semicolon. For example:

When this occurs, the DimensionValue._parseNum function receives "100%)", resulting in it returning 0.

Solution

This PR introduces a change that identifies and removes trailing semicolons (;) from linear-gradient values, ensuring correct parsing. It maintains the existing stripping of trailing ) in either case.

freemansoft commented 6 days ago

The current behavior isn't correct and should be fixed

  1. Is a trailing ";" valid syntax? It feels like a leftover css-ism.
  2. Should the parsing fail if it isn't valid?
apackin commented 6 days ago

The current behavior isn't correct and should be fixed

  1. Is a trailing ";" valid syntax? It feels like a leftover css-ism.

It's automatically included in the export when our designer adds the gradient from the GUI that references a sibling token set. I'm not familiar with the inner workings or intentions of the figma token exporter.. is that open source too?

  1. Should the parsing fail if it isn't valid?

Yes, I agree that the silent failing is also an issue. Added a 👍 to https://github.com/mark-nicepants/figma2flutter/issues/20.

apackin commented 3 hours ago

Our designer was able to remove the trailing ; in the GUI