printBox method

void printBox(
  1. String text
)

Implementation

void printBox(String text) {
  final lines = text.split('\n');
  final maxLength =
      lines.map((l) => l.length).reduce((a, b) => a > b ? a : b);

  print('$_cyan╔${'═' * (maxLength + 2)}╗$_reset');
  for (var line in lines) {
    final padding = ' ' * (maxLength - line.length);
    print('$_cyan║$_reset $line$padding $_cyan║$_reset');
  }
  print('$_cyan╚${'═' * (maxLength + 2)}╝$_reset');
}