bernaferrari / FigmaToCode

Generate responsive pages and apps on HTML, Tailwind, Flutter and SwiftUI.
https://www.figma.com/community/plugin/842128343887142055
GNU General Public License v3.0
3.58k stars 262 forks source link

Wrong `height` value in Flutter's TextStyle #77

Closed ksokolovskyi closed 11 months ago

ksokolovskyi commented 11 months ago

According to the Flutter documentation of the TextStyle class (https://api.flutter.dev/flutter/painting/TextStyle/height.html): height - "The height of this text span, as a multiple of the font size."

Currently, when the user sets a Line height parameter of the font, the plugin just uses this value for the height of the TextStyle, which is wrong.

I propose to do the next:

  1. Line height unit == AUTO: skip it in TextStyle;
  2. Line height unit == PIXELS: set value as lineHeight.value / fontSize in TextStyle;
  3. Line height unit == PERCENT: set value as lineHeight.value / 100 in TextStyle.