auto_size_text
3.0.0, released 5 years ago by simc.dev
Automatically resizes text to fit perfectly within its bounds.
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.
- flutter_auto_size_text
Flutter widget that automatically resizes text to fit perfectly within its bounds.
59Compare - auto_size_text_pk
A Flutter widget that automatically resizes text to fit perfectly within its bounds.
50Compare - auto_size_text_plus
Flutter widget that automatically resizes text to fit within its bounds.
50Compare - re_editor
A lightweight text and code editor widget for Flutter with syntax highlighting and folding.
80Compare
Works with
Packages commonly used together with auto_size_text: ones it builds on, ones built on it, and its own family.
- flutter_holo_date_pickerBuilt on auto_size_textA Flutter date picker widget inspired by the Android Holo Theme.
- flutter_side_menuBuilt on auto_size_textA fully customizable side menu widget for Flutter navigation and filters.
- onboarding_overlayBuilt on auto_size_textFlexible to control Onboarding overlay with or without target element (fork from onboard_overlay)
- checkbox_groupedBuilt on auto_size_textFlutter widgets for grouping checkboxes, chips, and switches with selection controllers.
- flutter_simple_calculatorBuilt on auto_size_textA Flutter widget that provides a simple calculator UI.
- flutter_deckBuilt on auto_size_textA lightweight, customizable framework to create presentations in Flutter.
- khqr_sdkBuilt on auto_size_textStandardization of QR Code (EMV) that will promote wider use of mobile retail payments in Cambodia.