insertTextPlaceholder method Null safety

  1. @override
void insertTextPlaceholder(
  1. Size size
)
override

Requests that the client add a text placeholder to reserve visual space in the text.

For example, this is called when responding to UIKit requesting a text placeholder be added at the current selection, such as when requesting additional writing space with iPadOS14 Scribble.

Implementation

@override
void insertTextPlaceholder(Size size) {
  if (!widget.scribbleEnabled) {
    return;
  }

  if (!widget.controller.selection.isValid) {
    return;
  }

  setState(() {
    _placeholderLocation = _value.text.length - widget.controller.selection.end;
  });
}