SystemContextMenu.editableText constructor

SystemContextMenu.editableText({
  1. Key? key,
  2. required EditableTextState editableTextState,
  3. List<IOSSystemContextMenuItem>? items,
})

Creates an instance of SystemContextMenu for the field indicated by the given EditableTextState.

Implementation

factory SystemContextMenu.editableText({
  Key? key,
  required EditableTextState editableTextState,
  List<IOSSystemContextMenuItem>? items,
}) {
  final (startGlyphHeight: double startGlyphHeight, endGlyphHeight: double endGlyphHeight) =
      editableTextState.getGlyphHeights();

  return SystemContextMenu._(
    key: key,
    anchor: TextSelectionToolbarAnchors.getSelectionRect(
      editableTextState.renderEditable,
      startGlyphHeight,
      endGlyphHeight,
      editableTextState.renderEditable.getEndpointsForSelection(
        editableTextState.textEditingValue.selection,
      ),
    ),
    items: items ?? getDefaultItems(editableTextState),
    onSystemHide: editableTextState.hideToolbar,
  );
}