Repository navigation
Missing API for TextSelectionToolbar styling #22210
Description
Activity
- addedc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packages
on Sep 24, 2018 - addeda: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problems
on Feb 14, 2019 - addedP2Important issues not at the top of the work listImportant issues not at the top of the work list
on May 29, 2020 @justinmc Generally speaking, we have two ideas for those issues. One is to completely refactor/fix widgets related to similar behaviors of the overlay, another is add properties into them for customization. Which one make sense to you? FYI @LongCatIsLooong
(Sorry for the late reply)
CC @darrenaustin who I believe was just working on text selection menu theming. Did you notice this problem (theme not being applied due to Overlay) and any opinions here?
I think in general we try to avoid accumulating lots of properties and want to keep it clean and composable, but it depends on how much of a breaking change it would be.
CC @darrenaustin who I believe was just working on text selection menu theming. Did you notice this problem (theme not being applied due to Overlay) and any opinions here?
I haven't really looked at the toolbar that closely, nor am I that familiar with the overlay, but I can take a look. Perhaps it is an issue with the overlay using a different context?
I recently added a
TextSelectionThemethat we are in the process of migrating to. It covers the colors for the cursor, text selection and text selection handles. It might make sense to add text selection toolbar config to this as well instead of introducing another theme.Reacted by Alex Li and Alex MyznikovThanks for the context on TextSelectionTheme. No need to dive any deeper unless you're interested, I just wanted to make sure this issue is in sync with your theme work.
Since TextSelectionTheme colors the handles, it seems like it could be affected by any solution to this Overlay problem here.
Is this somehow already adressed? I am currently struggling with this #92092
No, there is no theming for TextSelectionToolbar in TextSelectionTheme right now. You could work around this by implementing your own text selection toolbar, but it's overly complicated for this problem (example).
It's now possible to use any widget as the text selection toolbar via
contextMenuBuilder. Also, all built-in toolbar widgets and their button widgets have been made public. See AdaptiveTextSelectionToolbar.There are no new explicit Theme values that configure these toolbars, but they can be easily swapped out for other widgets. We may still want to investigate the themeability of these built-in toolbars in the future.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Nov 11, 2022
There is no way to override
TextSelectionToolbarstyles.Example below doesn't have any effect on TextSelectionToolbar styling
Background color of TextSelectionToolbar is also not obvious to override (it comes from underlying
Materialwhich takescanvasColoras a background). This chain of "dependencies" is not really obvious, so maybe it worth extendingThemeDatawithtextSelectionToolbarThemeprop?Flutter doctor output: