render method

  1. @override
String render()
override

Renders the component as a string.

Implementation

@override
String render() {
  if (_rows.isEmpty) return '';

  final buffer = StringBuffer();

  for (var i = 0; i < _rows.length; i++) {
    if (i > 0) buffer.writeln();

    final (left, right) = _rows[i];
    final detail = TwoColumnDetail(renderConfig: _renderConfig)
      ..left(left)
      ..right(right)
      ..fillChar(_fillChar)
      ..indent(_indent);

    if (_width != null) detail.width(_width!);
    if (_leftStyle != null) detail.leftStyle(_leftStyle!);
    if (_rightStyle != null) detail.rightStyle(_rightStyle!);
    if (_fillStyle != null) detail.fillStyle(_fillStyle!);
    if (_styleFunc != null) detail.styleFunc(_styleFunc!);

    buffer.write(detail.render());
  }

  return buffer.toString();
}