render method

String render(
  1. int width
)

Implementation

String render(int width) {
  if (value.length > width) {
    // Narrowed column.
    return '${value.substring(0, width - 2)}..';
  }
  switch (direction) {
    case AlignmentDirection.left:
      return value.padRight(width);
    case AlignmentDirection.right:
      return value.padLeft(width);
    case AlignmentDirection.center:
      final diff = width - value.length;
      return ' ' * (diff ~/ 2) + value + (' ' * (diff - diff ~/ 2));
  }
}