css property

String get css

CSS declarations for this style.

Implementation

String get css => _css([
      if (fontSize != null) 'font-size: ${_px(fontSize!)}',
      if (fontWeight != null)
        'font-weight: ${switch (fontWeight!) {
          FontWeight.bold => 'bold',
          FontWeight.normal => 'normal',
          _ => fontWeight!.index < 9
              ? '${(fontWeight!.index + 1) * 100}'
              : 'normal',
        }}',
      if (fontStyle != null) 'font-style: $fontStyle',
      if (color != null) 'color: ${color!.css}',
      if (letterSpacing != null) 'letter-spacing: ${_px(letterSpacing!)}',
      if (height != null) 'line-height: $height',
      if (fontFamily != null) 'font-family: $fontFamily',
      if (decoration != null)
        'text-decoration: ${switch (decoration!) {
          TextDecoration.none => 'none',
          TextDecoration.underline => 'underline',
          TextDecoration.lineThrough => 'line-through',
        }}',
    ]);