Skip to content
pubscout

auto_size_text

3.0.0, released 5 years ago by simc.dev

Automatically resizes text to fit perfectly within its bounds.

Flutter FavoriteWASM-readyQuiet but busy
$ flutter pub add auto_size_text
Source repository

What it does

Provides an AutoSizeText widget that behaves like standard Text but automatically adjusts its font size to prevent overflow within its container constraints. It supports rich text, custom min/max font sizes, step granularity, preset sizes, and synchronizing multiple text sizes via groups.

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

Use it when

  • You need text to shrink automatically to fit a specific container width or height
  • You want to synchronize font sizes across multiple text elements using groups
  • You want to specify preset font sizes or a fallback overflow replacement widget

Skip it when

  • The container has unbounded constraints (like an unconstrained Row or Column) without using Expanded or SizedBox
  • You want a complex layout component rather than a single-purpose text scaling widget

Strengths

  • Drop-in replacement for standard Flutter Text widgets
  • Supports RichText via AutoSizeText.rich
  • Group feature allows syncing font sizes across multiple text widgets

Weaknesses

  • Requires bounded constraints to calculate scaling properly
  • Setting an unreasonably high initial font size can impact performance

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
AutoSizeText(
  'The text to display',
  style: TextStyle(fontSize: 20),
  maxLines: 2,
)

Alternatives

Packages that do the same job and could replace auto_size_text.

Works with

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