TextSelectionTheme support (step 1 of 3)#62014
TextSelectionTheme support (step 1 of 3)#62014darrenaustin merged 4 commits intoflutter:masterfrom darrenaustin:text_selection_theme
Conversation
justinmc
left a comment
There was a problem hiding this comment.
LGTM, just some formatting I got carried away with. Thanks for doing this!
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
There was a problem hiding this comment.
Please add the diagram that you have on the PR to the docs: that makes it super clear what you're talking about.
There was a problem hiding this comment.
We seem to be on a nice trajectory here :-). How about : The color of the cursor. Here and elsewhere and in general. For example: The color of the TextField's selection handles, instead of "The color used to paint the selection handles on the text field".
There was a problem hiding this comment.
Doesn't indicate the current text insertion point? Here and elsewhere.
There was a problem hiding this comment.
that defines the configuration for the rendering of text selection => that defines the appearance of text selection
There was a problem hiding this comment.
This works because the TextField doesn't actually use TextSelectionTheme directly right? Otherwise we'd have to include a Builder.
There was a problem hiding this comment.
TextField looks up the current theme with TextSelectionTheme.of(context) in the build method, so it should work fine here.
Create a new TextSelectionTheme for text selection properties.
Create a new TextSelectionTheme for text selection properties.

Description
As part of the larger theme system update, this PR provides a new
TextSelectionThemethat configures the visual properties of text selection inTextFieldandSelectableTextwidgets. The initial supported properties are thecursorColor,selectionColorandselectionHandleColor, with more to come in future PRs.These properties will now replace the existing equivalent properties in
ThemeData(i.ecursorColor,textSelectionColorandtextSelectionHandleColor). As such the properties onThemeDatawill be deprecated.In addition to this deprecation, we are updating the default values for each of these properties to use the colors in the
ThemeData.colorScheme. This will eventually be a breaking change. However, for this first step this is all turned off by default. To turn on the text selection theme support you can set the new temporary opt-inThemeData.useTextSelectionThemeflag to true.A more detailed description can be found in the design doc. It also includes a migration guide for migrating application code to use the new theme.
Related Issues
#17635
#56082
#61227
Tests
I added tests for the new theme as well as updating the overall
ThemeDatatests.Checklist
///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
This PR specifically won't break any tests, as it is a soft migration. Overall however, after all stages of this are complete it will be a breaking change.