resolveInline method

TextStyle resolveInline(
  1. bool bold,
  2. bool italic,
  3. bool under,
  4. bool strike,
  5. bool isAllInOne,
)

Implementation

pw.TextStyle resolveInline(
    bool bold, bool italic, bool under, bool strike, bool isAllInOne) {
  pw.TextDecoration? decoration = null;
  if (under && strike ) {
    decoration = pw.TextDecoration.combine(
      [pw.TextDecoration.lineThrough, pw.TextDecoration.underline],
    );
  } else if (strike) {
    decoration = pw.TextDecoration.lineThrough;
  } else if (under) {
    decoration = pw.TextDecoration.underline;
  }

  return !isAllInOne
      ? copyWith(
          fontWeight: bold ? pw.FontWeight.bold : pw.FontWeight.normal,
          fontStyle: italic ? pw.FontStyle.italic : pw.FontStyle.normal,
          decoration: decoration,
        )
      : copyWith(
          fontWeight: pw.FontWeight.bold,
          fontStyle: pw.FontStyle.italic,
          decoration: decoration,
        );
}