# RenderBox 未布局：RenderViewport#abcde 需要具有 'size'，但其约束为 'BoxConstraints(unconstrained)'

- **ID:** `flutter/rendering-box-height-nan`
- **领域:** flutter
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

可滚动小部件（例如 ListView、GridView）放置在 Column 或 Row 中，未获得显式约束，导致高度无限。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.0.0 | active | — | — |
| 3.10.0 | active | — | — |
| 3.16.0 | active | — | — |
| 3.22.0 | active | — | — |

## 解决方案

1. ```
   Wrap the scrollable widget in an Expanded or Flexible inside a Column or Row to give it bounded constraints.
   ```
2. ```
   Use a CustomScrollView with slivers instead of nesting a ListView in a Column.
   ```
3. ```
   Set a specific height constraint using SizedBox or Container with a height, but ensure it's enough for content.
   ```

## 无效尝试

- **** — If content exceeds the fixed height, the ListView will overflow or clip; not adaptive. (40% 失败率)
- **** — Expanded requires bounded constraints; if parent is unconstrained, it still fails. (35% 失败率)
- **** — Does not give the ListView bounded constraints; the Column still tries to size itself to the ListView's infinite height. (25% 失败率)
