StyledText constructor

StyledText(
  1. String data, {
  2. TextStyle? style,
  3. TextAlign? textAlign,
  4. int? maxLines,
})

Creates styled text rendered as a span.

StyledText('Hello', style: TextStyle(fontWeight: FontWeight.w600));

Implementation

StyledText(String data,
    {TextStyle? style, TextAlign? textAlign, int? maxLines})
    : super('span',
          text: data,
          style: _css([
            style?.css ?? '',
            if (textAlign != null) 'text-align: ${textAlign.name}',
            if (maxLines != null) 'display: -webkit-box',
            if (maxLines != null) '-webkit-line-clamp: $maxLines',
            if (maxLines != null) '-webkit-box-orient: vertical',
            if (maxLines != null) 'overflow: hidden',
          ]));