setSelection

Function

Common
fun SemanticsPropertyReceiver.setSelection(
    label: String? = null,
    action: ((startIndex: Int, endIndex: Int, relativeToOriginalText: Boolean) -> Boolean)?,
)

Action to set text selection by character index range.

If this action is provided, the selection data must be provided using textSelectionRange.

Parameters

labelOptional label for this action.
actionAction to be performed when the SemanticsActions.SetSelection is called. The parameters to the action are: startIndex, endIndex, and whether the indices are relative to the original text or the transformed text (when a VisualTransformation is applied).