Skip to content
pubscout

flutter_auto_size_text

5.0.0, released 9 months ago by an unverified publisher

Flutter widget that automatically resizes text to fit perfectly within its bounds.

WASM-ready
$ flutter pub add flutter_auto_size_text
Source repository

What it does

AutoSizeText behaves like a standard Flutter Text widget but automatically adjusts its font size to fit within the given boundaries. It supports maxLines, custom minimum and maximum font sizes, group synchronization, and rich text via TextSpans.

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

Use it when

  • You need text to shrink down in order to fit inside constrained UI boundaries.
  • You want to synchronize the font size of multiple text widgets across the screen.
  • You want to display a fallback replacement widget when text overflows.

Skip it when

  • The parent widget does not provide bounded constraints (e.g., inside an unconstrained Row without Expanded).
  • You require high-performance rendering with thousands of unconstrained text elements using massive font size ranges.

Strengths

  • Automatically scales font size based on available bounds and maxLines.
  • Supports synchronizing font sizes across multiple text widgets using AutoSizeGroup.
  • Supports rich text formatting via AutoSizeText.rich().

Weaknesses

  • Requires proper bounded constraints from parent layout widgets to work correctly.
  • May have performance overhead if configured with an unreasonably high starting font size and large range.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0

not documented

AutoSizeText(
  'The text to display',
  style: TextStyle(fontSize: 20),
  maxLines: 2,
)

Alternatives

Packages that do the same job and could replace flutter_auto_size_text.