Conversation
| if (selectionControls == null) | ||
| handle = Container(); | ||
| else { | ||
| handle = Visibility( |
There was a problem hiding this comment.
There are two ways to control the handle visibilities, first from TextSelectionOverlay.handlesVisible and second from renderEditable.selectionStartHandleInViewport. This pr creates a _effectiveStartHandleVisibility to merge both api and feed it directly into _SelectionHandleOverlay.
The difference is the _SelectionHandleOverlay use a fadeintransition instead of visibility widget. There might be a really minor visual difference.
There was a problem hiding this comment.
There is an issue (#52425) open about needing to do more fading to match native, so we probably need to make some changes there anyway.
| widget.glyphHeight, | ||
| widget.glyphHeight, | ||
| ); | ||
| final Size handleSize = widget.selectionControls.getHandleSize( |
There was a problem hiding this comment.
I think this should have used glyphHeight instead of lineHeight. The size is used to pad gesture rect to make it easier to tap. This refactor also fixes it because the preferredLineHeight now contains the glyphHeight
justinmc
left a comment
There was a problem hiding this comment.
LGTM, looks like a major win 👍
| if (selectionControls == null) | ||
| handle = Container(); | ||
| else { | ||
| handle = Visibility( |
There was a problem hiding this comment.
There is an issue (#52425) open about needing to do more fading to match native, so we probably need to make some changes there anyway.
| // If we are in build state, it will be too late to update visibility. | ||
| // We will need to schedule the build in next frame. | ||
| if (SchedulerBinding.instance.schedulerPhase == SchedulerPhase.persistentCallbacks) { | ||
| SchedulerBinding.instance.addPostFrameCallback(_markNeedsBuild); |
There was a problem hiding this comment.
It's great that you could get rid of an addPostFrameCallback 👍
* Unify Text selection API * fix test * further simplify * fix more tests * styling change
Unify lineHeight API and Visibility API.
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.