Skip to content
pubscout

rich_text_controller

3.0.1, released 2 years ago by micazi.dev

An extended text editing controller supporting different inline styles for custom regex patterns.

WASM-ready
$ flutter pub add rich_text_controller
Source repository

What it does

Extends Flutter's text editing controller to allow dynamic inline text styling using custom regular expression patterns. It provides interactive callbacks for matched text, IME composition support, and performance optimizations via regex caching.

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

Use it when

  • You need to highlight specific patterns like hashtags or mentions inside a TextField.
  • You want custom inline styling and tap actions for text matching regex rules.

Skip it when

  • You are just displaying static rich text without text editing capabilities.
  • You need a full-featured markdown or rich text editor component rather than basic regex highlighting.

Strengths

  • Custom regex pattern styling
  • Interactive callbacks for user interaction with matched text
  • IME composition support for languages like Japanese and Chinese

Weaknesses

  • Limited to regex-based inline styling within a text input controller
  • Not a complete WYSIWYG or markdown editor suite

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
1
TextField(
  controller: RichTextController(
    text: '',
    targetMatches: [
      MatchTargetItem(
        textStyle: TextStyle(color: Colors.blue, fontWeight: FontWeight.bold),
        regex: RegExp(r'#[a-zA-Z0-9_]+'),
      ),
    ],
  ),
)

Alternatives

Packages that do the same job and could replace rich_text_controller.