render method

  1. @override
String render()
override

Renders the component as a string.

Implementation

@override
String render() {
  final styledLeft = _applyLeftStyle(_left);
  final styledRight = _applyRightStyle(_right);

  final leftLen = Style.visibleLength(_left);
  final rightLen = Style.visibleLength(_right);
  final totalWidth = _width ?? _renderConfig.terminalWidth;
  final available = totalWidth - _indent - leftLen - rightLen - 2;

  String fill;
  if (available > 0) {
    final fillChars = _fillChar * available;
    fill = ' ${_applyFillStyle(fillChars)} ';
  } else {
    fill = ' ';
  }

  return '${' ' * _indent}$styledLeft$fill$styledRight';
}