dynamic_text_highlighting 0.0.33 copy "dynamic_text_highlighting: ^0.0.33" to clipboard
dynamic_text_highlighting: ^0.0.33 copied to clipboard

outdated

Dynamic Text Highlighting (DTH) is a Flutter package written in pure Dart, ideal for highlighting search results.

Dynamic Text Highlighting (DTH) #

This package is used to highlight, in a completely dynamic way, a keyword, or a phrase, wherever it is present in a specified text.

demo

Getting Started #

DynamicTextHighlighting is also the name of the package widget. It returns a RichText widget, or a Text widget if there is nothing highlighted. It accepts four parameters:

  • text: this is the whole text.
  • highlightText: this is only the highlighted text.
  • highlightColor: nothing to say.
  • style: this is the default text style.

Example #

Widget buildDTH(String text, String highlightText) {
  return DynamicTextHighlighting(
    text: text,
    highlightText: highlightText,
    highlightColor: Colors.yellow,
    style: TextStyle(
      fontSize: 18.0,
      fontWeight: FontWeight.bold,
    ),
  );
}

It is a stateless widget, so for any changes just call setState(() {...}).

void applyChanges(String newHighlightText) {
  setState(() {
    highlightText = newHighlightText;
  });
}
54
likes
40
pub points
69%
popularity

Publisher

unverified uploader

Dynamic Text Highlighting (DTH) is a Flutter package written in pure Dart, ideal for highlighting search results.

Repository (GitHub)
View/report issues

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on dynamic_text_highlighting