auto_size_text_pk
3.0.0, released 6 years ago by codepur.dev
A Flutter widget that automatically resizes text to fit perfectly within its bounds.
What it does
AutoSizeText behaves like a standard Text widget but automatically scales down the font size so that the text fits into its given constraints. It supports minimum and maximum font size bounds, step granularities, preset sizes, and synchronizing font sizes across multiple text elements using 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 in order to fit within a specific bounded space without overflowing.
- You want to synchronize the font size of multiple text widgets to match the smallest one in a group.
- You want to display an alternative overflow widget when the text cannot fit within the constraints.
Skip it when
- The widget lacks bounded constraints (such as inside an unconstrained Row or Column without Expanded).
- You only need standard text wrapping without automatic scaling.
Strengths
- Automatically scales text to fit available bounds preventing overflow.
- Supports synchronizing font sizes across multiple text widgets using AutoSizeGroup.
- Provides rich text support via AutoSizeText.rich.
Weaknesses
- Requires bounded constraints to calculate and resize properly.
- Unreasonable high initial font sizes 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_pk.
- auto_size_text
This is the original official package that this fork (auto_size_text_pk) is based on.
50Compare
Works with
Packages commonly used together with auto_size_text_pk: ones it builds on, ones built on it, and its own family.