createLine method

String createLine({
  1. required String primaryMessage,
  2. String primaryColor = "",
  3. String secondaryMessage = "",
  4. String secondaryColor = "",
  5. LoggerAlignmentState? alignment,
  6. String fill = ' ',
})

Creates a formatted line with primary and/or secondary messages and colors, aligned based on the specified alignment. The line is filled with the specified character between the messages and the left/right sides of the line.

Required parameters:

  • primaryMessage: the primary message to display on the line.

Optional parameters:

  • primaryColor: the color for the primary message, as an ANSI escape code.
  • secondaryMessage: the secondary message to display on the line.
  • secondaryColor: the color for the secondary message, as an ANSI escape code.
  • alignment: the alignment for the messages on the line (default is left).
  • fill: the character to fill the line with (default is a space).

Returns: A formatted string with the specified messages, colors, alignment, and fill.

Implementation

String createLine(
    {required String primaryMessage,
    String primaryColor = "",
    String secondaryMessage = "",
    String secondaryColor = "",
    LoggerAlignmentState? alignment,
    String fill = ' '}) {
  List<String> spaces = addFillCaractere(
      primaryText: primaryMessage,
      fill: fill,
      secondaryText: secondaryMessage,
      alignment: alignment);
  return lineStructure(
    spaceLeft: spaces[0],
    spaceCenter: spaces[1],
    spaceRight: spaces[2],
    primaryText: primaryMessage,
    primaryColor: primaryColor,
    secondaryText: secondaryMessage,
    secondaryColor: secondaryColor,
  );
}