printTitle static method

void printTitle(
  1. String title,
  2. String body, {
  3. int? lineCount,
  4. int? titleCode,
  5. int? bodyCode,
  6. int? maxBodyChar,
  7. bool showAllDataBody = false,
})

print in console with line and color style
code must be 0-255 (for color)
Default:
lineCount = 60
titleCode = 172
bodyCode = 178
maxBodyChar = 200
showAllDataBody: false

Implementation

static void printTitle(
  String title,
  String body, {
  int? lineCount,
  int? titleCode,
  int? bodyCode,
  int? maxBodyChar,
  bool showAllDataBody = false,
}) {
  int newMaxBodyChar = maxBodyChar ?? 200;
  String newBody = showAllDataBody
      ? body
      : body.length > newMaxBodyChar
          ? body.substring(0, newMaxBodyChar)
          : body;
  String underLine =
      "$_limitColor\u001b[38;5;244m${'_' * (lineCount ?? 60)}$_limitColor";
  String upperLine =
      "$_limitColor\u001b[38;5;244m${'‾' * (lineCount ?? 60)}$_limitColor";
  debugPrint(underLine);
  debugPrint(
      "$_limitColor\u001b[38;5;${titleCode ?? 178}m$title$_limitColor");
  debugPrint(
      "$_limitColor\u001b[38;5;${bodyCode ?? 142}m$newBody$_limitColor");
  debugPrint(upperLine);
}