SystemContextMenu.editableText constructor

SystemContextMenu.editableText({
  1. Key? key,
  2. required EditableTextState editableTextState,
})

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

Implementation

factory SystemContextMenu.editableText({
  Key? key,
  required EditableTextState editableTextState,
}) {
  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,
      ),
    ),
    onSystemHide: () {
      editableTextState.hideToolbar();
    },
  );
}