createRenderEditable method

RenderEditable createRenderEditable()

Implementation

RenderEditable createRenderEditable() {
  _actualText ??= _buildTextSpan();
  TextSpan text = _actualText!;
  if (_actualText!.toPlainText().isEmpty) {
    text = placeholderTextSpan;
  } else if (obscureText) {
    text = _buildPasswordTextSpan(text.text!);
  }

  WidgetDelegate? widgetDelegate = ownerDocument.widgetDelegate;
  if (widgetDelegate != null) {
    cursorColor = widgetDelegate.getCursorColor();
    selectionColor = widgetDelegate.getSelectionColor();
    cursorRadius = widgetDelegate.getCursorRadius();
    _selectionControls = widgetDelegate.getTextSelectionControls();
  }

  renderEditable = RenderEditable(
    text: text,
    cursorColor: cursorColor,
    showCursor: _cursorVisibilityNotifier,
    maxLines: _maxLines,
    minLines: 1,
    expands: false,
    textScaleFactor: 1.0,
    textAlign: renderStyle.textAlign,
    textDirection: TextDirection.ltr,
    selection: blurSelection, // Default to blur
    selectionColor: selectionColor,
    offset: scrollOffset,
    readOnly: false,
    forceLine: true,
    onCaretChanged: _handleCaretChanged,
    obscureText: obscureText,
    cursorWidth: 2.0,
    cursorRadius: cursorRadius,
    cursorOffset: Offset.zero,
    enableInteractiveSelection: true,
    textSelectionDelegate: _textSelectionDelegate,
    devicePixelRatio: window.devicePixelRatio,
    startHandleLayerLink: _startHandleLayerLink,
    endHandleLayerLink: _endHandleLayerLink,
    ignorePointer: true,
  );
  return renderEditable!;
}