-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
The onSelectionChanged callback was added to SelectionArea by #108985, but the callback is only given plain text. It is not equivalent to onSelectionChanged of SelectableText.
I asked @chunhtai about this in #108231 (comment), so please refer to the comments starting from there.
Use case
An app that has the feature to highlight a selected piece of text.
When a user selects "pick" in "Peter Piper picked a peck of pickled peppers", there is no way to tell which one of the two "pick"s in the sentence should be highlighted, without necessary info on the selection.
The above is of course just an example. There should be more use cases that require detailed text selection information.
Proposal
The onSelectionChanged callback of SelectableText receives detailed information regarding text selection, like selection offsets. The arguments with the same name in SelectionArea should behave in the same way. It is not because both have the same name, but because I think there must be cases where some functionality that you want to implement in an app cannot be achieved without selection details.