flutter-text-rendering
/flutter-text-rendering
Diagnose and fix Flutter text display issues including text overflow, orphaned words, line breaking, truncation, multi-style spans, and text scaling. Use when text clips, leaves dangling single words, overflows containers, or requires rich inline spans; route typography tokens and visual hierarchy to flutter-ui-design and screen-level layout constraints to flutter-responsive-layout.
- Author
- thiennc-tesoglobal ↗
- Repository
- flutter-skills ↗
- Licence
- BSD-3-Clause
- Last repository change
- 05.10.2026
Assessment and security
- Files in this package
- 3
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 5
No signals detected. Repository changed on 05.10.2026, without references to retired models or APIs.
BSD-3-Clause, otwarta.
What it does and when to use it
Diagnose and fix Flutter text display issues including text overflow, orphaned words, line breaking, truncation, multi-style spans, and text scaling. Use when text clips, leaves dangling single words, overflows containers, or requires rich inline spans; route typography tokens and visual hierarchy to flutter-ui-design and screen-level layout constraints to flutter-responsive-layout.
Original author description
Diagnose and fix Flutter text display issues including text overflow, orphaned words, line breaking, truncation, multi-style spans, and text scaling. Use when text clips, leaves dangling single words, overflows containers, or requires rich inline spans; route typography tokens and visual hierarchy to flutter-ui-design and screen-level layout constraints to flutter-responsive-layout.
How it works
- Diagnose
- Rules
- Conditional references
- Verification
- Sources
SKILL.md preview
--- name: flutter-text-rendering description: Diagnose and fix Flutter text display issues including text overflow, orphaned words, line breaking, truncation, multi-style spans, and text scaling. Use when text clips, leaves dangling single words, overflows containers, or requires rich inline spans; route typography tokens and visual hierarchy to flutter-ui-design and screen-level layout constraints to flutter-responsive-layout. --- # Flutter Text Rendering Render readable, predictable text across dynamic content lengths, locales, and accessibility settings. ## Diagnose Identify the failure mechanism before adjusting layout: 1. **Main-axis flex overflow:** A non-flex `Text` can receive an unbounded constraint along a `Flex` main axis and choose an intrinsic size larger than the space available beside its siblings, producing `RenderFlex overflowed`. 2. **Orphaned words (widows):** The last word of a headline or paragraph dangles alone on a new line because line breaking occurred at the final whitespace. 3. **Uncontrolled truncation:** Text clips silently or exceeds intended lines without a visible truncation affordance (`ellipsis`, `fade`). 4. **Broken inline flow:** Multiple adjacent `Text` widgets in a `Row` break across lines awkwardly instead of flowing as a continuous paragraph. 5. **Text scale breakage:** Enlarged system font scale (`TextScaler`) causes text to clip inside fixed-height containers or push critical actions offscreen. ## Rules - **Constrain the competing branch, not every `Text`:** In a `Row`, use `Flexible`, `Expanded`, `SizedBox`, or `ConstrainedBox` when text must share finite horizontal space with siblings. In a `Column`, flex changes vertical allocation and is not a default fix for horizontal text overflow. Never add a flex child when the parent's main-axis constraint is unbounded. - **Prevent orphaned words only where segmentation fits:** A non-breaking space (`\u00A0`) can bind the final two words of space-delimited headings, titles, and callouts. Do not apply that heuristic universally across locales. - **Choose wrapping or truncation deliberately:** Allow natural wrapping when the full copy matters. When the product contract calls for truncation, pair an explicit `maxLines` with `TextOverflow.ellipsis`, `TextOverflow.fade`, or `TextOverflow.clip`. Do not set `softWrap: false` without verifying whether single-line clipping is acceptable. - **Use `Text.rich` for inline styling:** Prefer `Text.rich` for ambient style and text scaling when mixing weights, colors, inline badges (`WidgetSpan`), or link recognizers. Raw `RichText` needs deliberate span style and scaling, but can inherit ambient text direction. - **Measure text with `TextPainter` when layout depends on copy size:** When building dynamic chips, custom canvas callouts, or expandable "Read more" widgets, layout a `TextPainter` with explicit `maxWidth` plus the ambient direction, locale, and `TextScaler` to check rendered height and `didExceedMaxLines`. - **Adapt to text scaling:** Support enlarged system fonts (`MediaQuery.textScalerOf(context)`). Avoid hardcoded container heights around text; prefer flexible or scrollable containers. - **Account for internationalization:** Design copy containers to tolerate 20–35% text length expansion for localized strings and support bidirectional text (`TextDirection`). ## Conditional references - Read [text overflow and wrapping](references/text-overflow-and-wrapping.md) when fixing flex overflows, eliminating orphaned words with non-breaking spaces, configuring `TextPainter` measurements, or managing multi-line truncation. ## Verification Exercise the text component with: 1. Minimum length copy (empty or single short word). 2. Realistic expected copy. 3. Maximum length / localized copy (including accented and long non-whitespace strings). 4. Enlarged font scaling (`TextScaler.linear(1.5)` and `TextScaler.linear(2.0)`). 5. Constrained parent widths (narrow mobile screens, tight cards, list items). Write a widget test asserting no `RenderFlex` overflow, confirming intended line count, and verifying that truncation or non-breaking word pairing renders as expected. ## Sources - [Flutter Text class](https://api.flutter.dev/flutter/widgets/Text-class.html) - [Flutter RichText class](https://api.flutter.dev/flutter/widgets/RichText-class.html) - [Flutter TextPainter class](https://api.flutter.dev/flutter/painting/TextPainter-class.html) - [Flutter TextOverflow enum](https://api.flutter.dev/flutter/painting/TextOverflow.html) - [Flutter TextScaler class](https://api.flutter.dev/flutter/painting/TextScaler-class.html)
Files in this package (3)
- SKILL.md 5 KB
- evals/cases.json 7 KB
- references/text-overflow-and-wrapping.md 10 KB
Versions
The database has no other skills named flutter-text-rendering.
Database snapshot: 13.11.2026 · package version 555d472c9d8a (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100flutter-fix-layout-issues
Fixes Flutter layout errors (overflows, unbounded constraints) using Dart and Flutter MCP tools. Use when addressing "RenderFlex overflowed", "Vertical viewport was given unbounded height", or similar layout issues. - 100flutter-fix-layout-issues
Use when fixing RenderFlex overflow errors, unbounded height and width exceptions, or ParentDataWidget layout conflicts. - 100ux-css-layout
VS Code CSS conventions, file organization, class naming, standard sizes, SplitView/Grid layout, scrollable content, responsive layout, and text overflow/ellipsis patterns. Use when writing CSS, building layouts, or fixing text truncation issues. - 100flutter-build-responsive-layout
Use when implementing adaptive Flutter layouts across mobile, tablet, desktop, and web screen dimensions. - 100flutter-verify
Use after building or changing Flutter UI, or when the user runs /flutter-verify or asks to check how a screen looks. Renders the screen at small phone, phone, dark mode, large text, tablet and desktop sizes in a widget test, saves screenshots, catches overflow and layout… - 100flutter-setting-up-on-linux
Sets up a Linux environment for Flutter development. Use when configuring a Linux machine to run, build, or deploy Flutter applications.