getTextSpan method

TextSpan getTextSpan(
  1. TextSpan? root,
  2. String text,
  3. TextStyle style, {
  4. 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)]);
  }
}