• Renzo Olivares's avatar
    handleSelectWord in MultiSelectableSelectionContainerDelegate should handle... · 0e1056f8
    Renzo Olivares authored
    handleSelectWord in MultiSelectableSelectionContainerDelegate should handle rects inside of rects (#127478)
    
    Fixes #127076
    
    Sometimes a `Selectable`s rect may contain another `Selectable`s rect within it. In the case of `handleSelectWord` when choosing which `Selectable` to dispatch the `SelectionEvent` to, the event would be dispatched to the wrong `Selectable` causing an assertion error to be thrown. 
    
    <img width="577" alt="Screenshot 2023-05-24 at 2 46 13 AM" src="https://github.com/flutter/flutter/assets/948037/bb246966-acad-4d81-bd87-758c3ea6ea39">
    
    In the picture above the red outline shows the rect of a two-line piece of text. And the blue rect shows the rect of a piece of text that is on the second line of the two-line piece of text, but has been separated into its own rect for some case, for example when `TextSpan`s are separated by a `WidgetSpan`.
    
    We should check if the text layout of the selectable that has been dispatched the SelectionEvent contains the word, if not then return `SelectionResult.next`, and continue to look through the list of selectables.
    0e1056f8
selectable_region.dart 84.5 KB