Skip to content
pubscout

expandable_richtext

1.0.7, released 2 years ago by devcrew.io

A text widget supporting line expansion, clickables, hashtags, mentions, and custom tags.

WASM-ready
$ flutter pub add expandable_richtext
Source repository

What it does

Provides an expandable text widget that initially shows a defined number of lines of a long text with 'show more/less' triggers. It supports clickable mentions, hashtags, hyperlinks, and custom text segments with separate styling and callback options.

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

Use it when

  • You need to display long post descriptions or comments that can be expanded and collapsed.
  • You need to highlight and handle taps on @mentions, #hashtags, and links within text.
  • You require smooth animations when toggling between collapsed and expanded text states.

Skip it when

  • You only need standard plain text without expansion or rich inline tagging features.
  • You need a full-fledged rich text markdown editor rather than a display widget.

Strengths

  • Supports customizable styling for mentions, hashtags, links, and custom tags.
  • Provides animation capabilities for expansion and collapse transitions.
  • Includes tap callbacks for interactive text segments.

Weaknesses

  • Limited to text display and inline styling features.
  • No document editing or form input capabilities.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
Widget build(BuildContext context) {
  return ExpandableRichText(
    text: "Lorem Ipsum is simply dummy text...",
    expandText: 'show more',
    collapseText: 'show less',
    maxLines: 2,
    linkColor: Colors.blue,
  );
}

Alternatives

Packages that do the same job and could replace expandable_richtext.

  • auto_size_text

    Pick auto_size_text if you need text to automatically resize to fit its bounding box rather than expanding lines.