Flutter 3.3 added the SelectionArea() widget, allowing all compatible child widget contents to be selectable (and allowing a selection to encompass multiple widgets). The styled_text_package uses an older implementation of .selectable, requiring an explicit per-widget choice of selectable and which is not compatible with SelectionArea().
For your consideration, I would like to suggest a small change in styled_text_package to enable SelectionArea compatibility:
In styled_text.dart, change the RichText() widget on line 369 to a Text.rich() widget, which includes the same functionality as RichText() and also has built-in integration with SelectionArea(). After this change, StyledText() is selectable or not based on whether it is a child widget of a SelectionArea().
Before changing styled_text.dart, the entire text is unselectable. After the suggested change, everything within the SelectionArea() is selectable. My example includes a StyledText() with multiple tags, to show that it still works across text composed of multiple spans.
I love styled_text_package, as it makes complex text formatting so much easier in Flutter. Hopefully this suggestion is implementable. Thanks!
Flutter 3.3 added the SelectionArea() widget, allowing all compatible child widget contents to be selectable (and allowing a selection to encompass multiple widgets). The styled_text_package uses an older implementation of .selectable, requiring an explicit per-widget choice of selectable and which is not compatible with SelectionArea().
For your consideration, I would like to suggest a small change in styled_text_package to enable SelectionArea compatibility:
In styled_text.dart, change the RichText() widget on line 369 to a Text.rich() widget, which includes the same functionality as RichText() and also has built-in integration with SelectionArea(). After this change, StyledText() is selectable or not based on whether it is a child widget of a SelectionArea().
Minimal reproducible example:
Suggested change (lines 369 to 388 in styled_text.dart, just changing to Text.rich and changing span to a positional argument):
Before changing styled_text.dart, the entire text is unselectable. After the suggested change, everything within the SelectionArea() is selectable. My example includes a StyledText() with multiple tags, to show that it still works across text composed of multiple spans.
I love styled_text_package, as it makes complex text formatting so much easier in Flutter. Hopefully this suggestion is implementable. Thanks!