Skip to content
pubscout

highlight_text

1.8.0, released 2 years ago by feer.dev

A Flutter widget to highlight specific words in text with custom styles and actions.

WASM-ready
$ flutter pub add highlight_text
Source repository

What it does

Allows developers to supply a dictionary of words to highlight inside a text string. Each highlighted word can have its own text style, padding, box decoration, and tap action.

AI-written summary of version 1.8.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to highlight specific keywords or search terms within a body of text.
  • You want interactive words inside a text paragraph that trigger custom actions or callbacks when tapped.

Skip it when

  • You need complex rich text formatting that goes beyond simple word highlighting and custom spans.

Strengths

  • Supports custom tap actions, text styles, padding, and decorations for individual words.
  • Handles case-sensitivity matching options and prevents subword highlighting issues.

Weaknesses

  • Limited to string-based word matching dictionary models.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
Map<String, HighlightedWord> words = {
    "Flutter": HighlightedWord(
        onTap: () {},
        textStyle: TextStyle(color: Colors.blue),
    ),
};
TextHighlight(
    text: "Learn Flutter today",
    words: words,
)

Alternatives

Packages that do the same job and could replace highlight_text.