# Flutter错误：文本溢出与省略号和maxLines冲突

- **ID:** `flutter/text-overflow-ellipsis-conflict`
- **领域:** flutter
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 82%

## 根因

在Text小部件上同时设置overflow: TextOverflow.ellipsis和maxLines，但父级约束过于严格，导致文本被意外裁剪而非显示省略号。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Flutter 3.13 | active | — | — |
| Dart 3.1 | active | — | — |
| Flutter 3.19 | active | — | — |

## 解决方案

1. ```
   Use a Flexible or Expanded parent widget to give the Text widget adequate width for ellipsis to work.
   ```
2. ```
   Set textWidthBasis: TextWidthBasis.longestLine on the Text widget to improve ellipsis calculation.
   ```

## 无效尝试

- **** — Without maxLines, the text may expand infinitely, causing overflow errors in the parent widget. (55% 失败率)
- **** — softWrap: false disables line breaking entirely, leading to RenderFlex overflow warnings. (45% 失败率)
- **** — FittedBox scales the entire text widget, potentially making it unreadable at small sizes. (35% 失败率)
