2000calories / flutter_easy_rich_text

The EasyRichText widget provides an easy way to use RichText.
https://pub.dev/packages/easy_rich_text
MIT License
79 stars 34 forks source link

RichText properties applied to targetString #49

Closed mselmanyildirim closed 8 months ago

mselmanyildirim commented 11 months ago

Hi.
I liked Easy Rich Text very much. Thank you very much for your valuable efforts.
I've just wondered whether it is possible to use some RichText properties for only targetString? I'm rather interested in textAlign property at the moment, but other properties might be interesting to implement selectively too.
I'm willing to hear a workaround, if there is no direct way to do this.

2000calories commented 11 months ago

Hi, can you show me a sample code to clarify "to use some RichText properties for only targetString?".

mselmanyildirim commented 11 months ago

Yes. Sorry for late answer btw.

 EasyRichText(
    some_text,
    textAlign: TextAlign.center, // this is valid, but applies to whole text, so I don't want this
    patternList: [
      EasyRichTextPattern(
        targetString: "some_pattern_here",
        style: TextStyle(
          color: Colors.red,
          fontWeight: FontWeight.bold,
        ),
        textAlign: TextAlign.center // this would apply to only targetString, but it is invalid.
 ),