mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Fixes #110306 https://github.com/user-attachments/assets/d0a20ae9-912c-4ddc-bd6a-a21409468078 This change: * Allows selection handles on iOS to swap with each other when inverting on `TextField`. * Allows selection handles to visually collapse when inverting on `SelectableRegion`/`SelectionArea`, previously they showed both left and right handles when collapsed, instead of the collapsed handles. * Adds a border to the CupertinoTextMagnifier, the same color as the selection handles to match native iOS behavior. `SelectionOverlay`: * Previously would build an empty end handle when the selection was collapsed. Now it builds an empty end handle when the selection is being collapsed and the start handle is being dragged, and when the selection is collapsed and no handle is being dragged. * Hides start handle when the selection is being collapsed and the end handle is being dragged. * Keeps the handles from overlapping. `TextSelectionOverlay`: * Removes guards against swapping handles for iOS and macOS. * Tracks `_oppositeEdge` used to maintain selection as handles invert. `RenderParagraph`: * Send collapsed selection handle state in `SelectionGeometry`, previously we wouldn't so the collapsed state would show both start and end handles. `CupertinoTextMagnifier`: * Inherit border color from parent `CupertinoTheme.of(context).primaryColor`. Selection handles also uses `primaryColor`. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. --------- Co-authored-by: Renzo Olivares <roliv@google.com>