Flutter Fix Layout Issues Skill Security Audit
What the author says it does (original text)
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.
No obvious risks found in this check
- Files checked
- 1
- Risks found
- 0
Inside this skill
This Skill diagnoses Flutter constraint-related layout errors and selects Expanded, Flexible, SizedBox, or parent-child restructuring according to the specific error type.
View source
### 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.The workflow calls for running the app, performing hot reload, and visually checking error screens or overflow indicators. The supplied material contains no scripts, installation steps, network requests, credential access, or permission-changing instructions.
View source
- **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.The examples show localized Dart layout code before and after a fix, such as constraining a ListView inside a Column with Expanded.
View source
**Output (Resolved State):**```dart// Wrap ListView in Expanded to constrain its height to the remaining Column spaceColumn( children: <Widget>[ const Text('Header'), Expanded( child: ListView( children: const <Widget>[ ListTile(title: Text('Item 1')), ListTile(title: Text('Item 2')), ], ), ), ],)```Files and check records1 files
Coverage and gaps
Content covered in each file
These are the source ranges included in this check, not a guarantee that every issue has been resolved.
SKILL.mdFull text included
This report is for the version above. We read the available code and instructions without running the skill or checking extra packages it installs. This is not a promise of safety: a different version or setup may behave differently.
SKILL.mdInstructions
- Lines read
- 131
- File checksum (to compare versions)
- 856ef719f073431740ace0519d7d03560d825fca15c3e256d4cc0058f717ee06