paint method

  1. @override
String paint()
override

Implementation

@override
String paint() {
  final maxW = size.width.toInt();

  // Truncate lines to constrained width.
  var lines = text.split('\n');
  lines = lines.map((l) {
    final w = Style.visibleLength(l);
    if (w <= maxW) return l;
    return Layout.truncate(l, maxW, ellipsis: '');
  }).toList();

  // Apply selection highlighting if controller has active selection.
  final ctrl = controller;
  if (ctrl != null && ctrl.hasSelection) {
    lines = _applySelectionHighlighting(lines, 0, ctrl);
  }

  return lines.join('\n');
}