getTextSpan method
TextSpan
getTextSpan(
- TextSpan? root,
- String text,
- TextStyle style, {
- TapGestureRecognizer? tapRecognizer,
Wraps text with style inside the root.
root
optional, return TextSpan(text, style:style) if null
text
main content text
style
TextStyle
tapRecognizer
optional, tap action for detected content
Implementation
TextSpan getTextSpan(TextSpan? root, String text, TextStyle style,{TapGestureRecognizer? tapRecognizer}){
if(root == null){
return TextSpan(text: text,style: style,recognizer: tapRecognizer);
}else{
return TextSpan(children: [root, TextSpan(text: text, style: style,recognizer: tapRecognizer)]);
}
}