跳到主内容
智客 ZICQ

技能库 智客分类:Agent 工作流 flutter-fix-layout-issues

Flutter Fix Layout Issues

使用 Dart 和 Flust MCP 工具修复 Flust 排版错误(多流,无约束). 处理"RenderFlex溢出","Vertical Viewport被赋予了无限制的高度"时使用,或类似的布局问题.

41998 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

使用 Dart 和 Flust MCP 工具修复 Flust 排版错误( 过度流, 无约束)

何时用

地址“RenderFlex 溢出”、“Vertical Viewport 被赋予了无限制的高度”或类似的布局问题

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Resolving Flutter Layout Errors、Contents、Constraint Violation Diagnostics、Layout Error Resolution Workflow、Task Progress、Examples。 其中含规范建议的小节:分步指令、输入输出示例。

文件分析

文件分析:这是一份仅含 SKILL.md 的指令型技能,代理激活后整份正文进入上下文。

官方 description(原文)

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.

Resolving Flutter Layout ErrorsContentsConstraint Violation DiagnosticsLayout Error Resolution WorkflowTask ProgressExamplesFixing Unbounded Height (ListView in Column)Fixing Unbounded Width (TextField in Row)Fixing RenderFlex Overflow

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
flutter-fix-layout-issues
description
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.
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「flutter-fix-layout-issues」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-e1f41bf50728d45c-Flutter-%E4%BF%AE%E6%AD%A3%E7%89%88%E5%BC%8F%E9%97%AE%E9%A2%98.html
请存为 .cursor/skills/flutter-fix-layout-issues/SKILL.md 或 .claude/skills/flutter-fix-layout-issues/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/flutter/agent-plugins' --list

npx skills add 'https://github.com/flutter/agent-plugins' --skill 'flutter-fix-layout-issues'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: flutter-fix-layout-issues description: 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. metadata: model: models/gemini-3.1-pro-preview last_modified: Tue, 21 Apr 2026 19:45:59 GMT --- # Resolving Flutter Layout Errors ## Contents - [Constraint Violation Diagnostics](#constraint-violation-diagnostics) - [Layout Error Resolution Workflow](#layout-error-resolution-workflow) - [Examples](#examples) ## Constraint Violation Diagnostics Flutter layout operates on a strict rule: **Constraints go down. Sizes go up. Parent sets position.** Layout errors occur when this negotiation fails, typically due to unbounded constraints or unconstrained children. Diagnose layout failures using the following error signatures: * **"Vertical viewport was given unbounded height"**: Triggered when a scrollable widget (`ListView`, `GridView`) is placed inside an unconstrained vertical parent (`Column`). The parent provides infinite height, and the child attempts to expand infinitely. * **"An InputDecorator...cannot have an unbounded width"**: Triggered when a `TextField` or `TextFormField` is placed inside an unconstrained horizontal parent (`Row`). The text field attempts to determine its width based on infinite available space. * **"RenderFlex overflowed"**: Triggered when a child of a `Row` or `Column` requests a size larger than the parent's allocated constraints. Visually indicated by yellow and black warning stripes. * **"Incorrect use of ParentData widget"**: Triggered when a `ParentDataWidget` is not a direct descendant of its required ancestor. (e.g., `Expanded` outside a `Flex`, `Positioned` outside a `Stack`). * **"RenderBox was not laid out"**: A cascading side-effect error. Ignore this and look further up the stack trace for the primary constraint violation (usually an unbounded height/width error). ## Layout Error Resolution Workflow Copy and use this checklist to systematically resolve layout constraint violations. ### Task Progress - [ ] Run the application in debug mode to capture the exact layout exception in the console. - [ ] Identify the primary error message (ignore cascading "RenderBox was not laid out" errors). - [ ] Apply the conditional fix based on the specific error type: - **If "Vertical viewport was given unbounded height"**: Wrap the scrollable child (`ListView`, `GridView`) in an `Expanded` widget to consume remaining space, or wrap it in a `SizedBox` to provide an absolute height constraint. - **If "An InputDecorator...cannot have an unbounded width"**: Wrap the `TextField` or `TextFormField` in an `Expanded` or `Flexible` widget. - **If "RenderFlex overflowed"**: Constrain the overflowing child by wrapping it in an `Expanded` widget (to force it to fit) or a `Flexible` widget (to allow it to be smaller than the allocated space). - **If "Incorrect use of ParentData widget"**: Move the `ParentDataWidget` to be a direct child of its required parent. Ensure `Expanded`/`Flexible` are direct children of `Row`/`Column`/`Flex`. Ensure `Positioned` is a direct child of `Stack`. - [ ] Execute Flutter hot reload. - [ ] Run validator -> review errors -> fix: Inspect the UI to verify the red/grey error screen or yellow/black overflow stripes are resolved. If new layout errors appear, repeat the workflow. ## Examples ### Fixing Unbounded Height (ListView in Column) **Input (Error State):** ```dart // Throws "Vertical viewport was given unbounded height" Column( children: [ const Text('Header'), ListView( children: const [ ListTile(title: Text('Item 1')), ListTile(title: Text('Item 2')), ], ), ], ) ``` **Output (Resolved State):** ```dart // Wrap ListView in Expanded to constrain its height to the remaining Column space Column( children: [ const Text('Header'), Expanded( child: ListView( children: const [ ListTile(title: Text('Item 1')), ListTile(title: Text('Item 2')), ], ), ), ], ) ``` ### Fixing Unbounded Width (TextField in Row) **Input (Error State):** ```dart // Throws "An InputDecorator...cannot have an unbounded width" Row( children: [ const Icon(Icons.search), TextField(), ], ) ``` **Output (Resolved State):** ```dart // Wrap TextField in Expanded to constrain its width to the remaining Row space Row( children: [ const Icon(Icons.search), Expanded( child: TextField(), ), ], ) ``` ### Fixing RenderFlex Overflow **Input (Error State):** ```dart // Throws "A RenderFlex overflowed by X pixels on the right" Row( children: [ const Icon(Icons.info), const Text('This is a very long text string that will definitely overflow the available screen width and cause a RenderFlex error.'), ], ) ``` **Output (Resolved State):** ```dart // Wrap the Text widget in Expanded to force it to wrap within the available constraints Row( children: [ const Icon(Icons.info), Expanded( child: const Text('This is a very long text string that will definitely overflow the available screen width and cause a RenderFlex error.'), ), ], ) ```

相关技能

Agent 工作流

Skill Creator

创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.

Agent 工作流

Clawdhub

使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.

Agent 工作流

Agent Team Orchestration

管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.

Agent 工作流

Superpowers

Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…