regex_text_style 0.0.2 copy "regex_text_style: ^0.0.2" to clipboard
regex_text_style: ^0.0.2 copied to clipboard

Apply TextStyles based on Regex match.

regex_text_style #

This package will help you to apply TextStyles to a String and render them in RichText based on regex mathes. For example, you can make all the digits in your text bold and all letters l very big with the following example.

RegexTextStyle(
    text: 'Hello world 123',
    styles: [
        RegexStyle(r'\d', TextStyle(fontWeight: FontWeight.bold)),
        RegexStyle(r'l', TextStyle(fontSize: 100)),
    ],
     style: const TextStyle()
)

example

Getting started #

  • import the library
  • create a RegexTextStyle widget, provide the text, styles and a default style as in example above
  • order of styles dictates how they will apply/collide

Additional information #

Contact me via GitHub issues or Telegram

0
likes
100
pub points
32%
popularity

Publisher

unverified uploader

Apply TextStyles based on Regex match.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on regex_text_style