defaultTagTextStyle function

TextStyle defaultTagTextStyle(
  1. String lastTag,
  2. String tag,
  3. TextStyle textStyle
)

Implementation

TextStyle defaultTagTextStyle(String lastTag, String tag, TextStyle textStyle) {
  switch (tag) {
    case 'h1':
      textStyle = textStyle.copyWith(
        fontSize: (textStyle.fontSize ?? 0) + 9,
      );
      break;
    case 'h2':
      textStyle = textStyle.copyWith(
        fontSize: (textStyle.fontSize ?? 0) + 6,
      );
      break;
    case 'h3':
      textStyle = textStyle.copyWith(
        fontSize: (textStyle.fontSize ?? 0) + 4,
      );
      break;
    case 'h4':
      textStyle = textStyle.copyWith(
        fontSize: (textStyle.fontSize ?? 0) + 3,
      );
      break;
    case 'h5':
      textStyle = textStyle.copyWith(
        fontSize: (textStyle.fontSize ?? 0) + 2,
      );
      break;
    case 'h6':
      textStyle = textStyle.copyWith(
        fontSize: (textStyle.fontSize ?? 0) + 1,
      );
      break;
    case 'p':
      break;
    case 'li':
      break;
    case 'code':
      textStyle = textStyle.copyWith(
        fontSize: (textStyle.fontSize ?? 0) - 3,
        color: textStyle.color?.withAlpha(200),
      );
      if (lastTag == 'p') {
        textStyle = textStyle.copyWith(
          color: Colors.red.shade800,
        );
      }

      break;
    case 'strong':
      textStyle = textStyle.copyWith(
        fontWeight: FontWeight.bold,
      );
      break;
    case 'em':
      textStyle = textStyle.copyWith(
        fontStyle: FontStyle.italic,
      );
      break;
    case 'del':
      textStyle = textStyle.copyWith(
        decoration: TextDecoration.lineThrough,
      );
      break;
    case 'a':
      textStyle = textStyle.copyWith(
        color: Colors.blue,
      );
      break;
  }
  return textStyle;
}