Text Selection in widget span inside SelectionArea

Requirement: Text selection using SelectionArea widget when there are multiple textspans and widgetspans.

I know that text selection works well with textspans. But in my case I have widgetspan along with text spans due to which selection is not working properly.

I have a builder method that returns an InlineSpan so I can only use textspan and widgetspan.

SelectionArea(
child: Text.rich(
TextSpan(
children:[
WidgetSpan(
child: Container(
padding EdgeInsets.all(8.0),
child: SizedBox(),
)),
TextSpan(text: 'Hello world'),
WidgetSpan(
child: Container(
padding EdgeInsets.all(8.0),
child: SizedBox(),
)),
]
)));

Show use some code. I have never did this, I need to look at the code and search to be able to advise.

@mihalycsaba I have put some sample code.

why don’t you put the padding around the textspan and remove the widgetspan?

Actually this is just an example, in my case the outer textspan has 3 children, widgetspan, textspan and a widgetspan.
In actual code the widgetspans are used for some box decoration.