render method
Renders the component as a styled string.
Subclasses implement this to produce their ANSI-styled output.
Implementation
@override
String render() {
final width = renderConfig.terminalWidth;
if (text == null) {
return char * width;
}
final label = ' $text ';
final remaining = width - Style.visibleLength(label);
final safeRemaining = remaining > 0 ? remaining : 0;
final left = safeRemaining ~/ 2;
final right = safeRemaining - left;
return '${char * left}$label${char * right}';
}