Use when working on accessibility, a11y, WCAG, ARIA, screen readers, keyboard nav, focus order, contrast, alt text, captions, reduced motion, or target sizes; not language/culture/device (see inclusive-design).
中文简介正在准备中。当前显示原文说明。
Use when hitting layout errors (RenderFlex overflow, unbounded constraints, RenderBox not laid out), scroll errors, or setState-during-build errors.
中文简介正在准备中。当前显示原文说明。
查看安装方法安装前可以查看交给 AI 代理的指令内容。
This skill provides solutions for the most common Flutter runtime and layout errors.
Error: A RenderFlex overflowed by X pixels on the right/bottom.
Cause: A Row or Column contains children that are wider/taller than the available space.
Fix: Wrap the overflowing child in Flexible or Expanded, or constrain its size:
Row(
children: [
Expanded(child: Text('Long text that might overflow')),
Icon(Icons.info),
],
)
Error: Vertical viewport was given unbounded height.
Cause: A ListView (or other scrollable) is placed inside a Column without a bounded height.
Fix: Wrap the ListView in Expanded or give it a fixed height with SizedBox:
Column(
children: [
Text('Header'),
Expanded(
child: ListView(children: [...]),
),
],
)
Error: An InputDecorator...cannot have an unbounded width.
Cause: A TextField or similar widget is placed in a context without width constraints.
Fix: Wrap it in Expanded, SizedBox, or any parent that provides width constraints:
Row(
children: [
Expanded(child: TextField()),
],
)
Error: setState() or markNeedsBuild() called during build.
Cause: setState or showDialog is called directly inside the build method.
Fix: Trigger state changes in response to user actions, or defer to after the frame using addPostFrameCallback:
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
// Safe to call setState or showDialog here
});
}
Error: The ScrollController is attached to multiple scroll views.
Cause: A single ScrollController instance is shared across more than one scrollable widget simultaneously.
Fix: Ensure each scrollable widget has its own dedicated ScrollController instance.
Error: RenderBox was not laid out: ...
Cause: A widget is missing or has unbounded constraints — commonly ListView or Column without proper size constraints.
Fix: Review your widget tree for missing constraints. Common patterns:
ListView in Expanded inside a Column.width or height via SizedBox or ConstrainedBox.debugPaintSizeEnabled = true; temporarily in your main() to paint layout bounds.还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Use when working on accessibility, a11y, WCAG, ARIA, screen readers, keyboard nav, focus order, contrast, alt text, captions, reduced motion, or target sizes; not language/culture/device (see inclusive-design).
中文简介正在准备中。当前显示原文说明。
Use when creating a feature, designing folder structure, adding repositories/services/view models, wiring dependency injection, or deciding which layer owns logic.
中文简介正在准备中。当前显示原文说明。
Use when creating a Cubit or Bloc, modeling state with sealed classes or status enums, wiring BlocBuilder/BlocListener/BlocProvider, writing bloc tests, or choosing between Cubit and Bloc.
中文简介正在准备中。当前显示原文说明。
Use when asked to review a PR, MR, branch, or diff, audit changed files, or check code quality.
中文简介正在准备中。当前显示原文说明。
Use when writing switch statements, refactoring if-else chains, creating data classes, choosing records vs classes, destructuring values, or modernizing pre-Dart-3 code.
中文简介正在准备中。当前显示原文说明。
Use when building AI agents in Dart, implementing Genkit flows or tools, integrating LLMs into Dart or Flutter applications, or using Genkit Dart plugins.
中文简介正在准备中。当前显示原文说明。