Skip to content
pubscout

custom_text

2.0.4, released 2 years ago by kaboc.cc

Customisable text widget with advanced styling, gesture interactions, and a text editing controller.

WASM-ready
$ flutter pub add custom_text
Source repository

What it does

Provides a text widget and controller that let you style partial strings, handle gestures like taps and long-presses, and replace portions of text with custom widgets or inline spans using regular expressions and preset matchers.

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

Use it when

  • You need to make specific substrings like URLs, emails, hashtags, or phone numbers tappable or highlighted.
  • You want to build custom text parsing rules with regex or custom matchers inside normal text or text fields.

Skip it when

  • You only need simple basic text styling without regex matching, custom gestures, or partial highlighting.

Strengths

  • Highly customisable with preset matchers like URLs, emails, and phone numbers.
  • Supports interactive gestures, hover states, and mouse cursor changes per definition.
  • Includes a special TextEditingController for text editing support.

Weaknesses

  • Adds overhead compared to a standard Flutter Text widget for simple use cases.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
2
CustomText(
  'URL: https://example.com/\n'
  'Email: foo@example.com',
  definitions: const [
    TextDefinition(matcher: UrlMatcher()),
    TextDefinition(matcher: EmailMatcher()),
  ],
  matchStyle: const TextStyle(color: Colors.lightBlue),
)

Alternatives

Packages that do the same job and could replace custom_text.

  • auto_size_text

    Pick auto_size_text instead if your primary goal is automatically resizing text to fit within its bounds.

Works with

Packages commonly used together with custom_text: ones it builds on, ones built on it, and its own family.