Skip to content

Commit c0a2416

Browse files
authored
Merge pull request #34 from FlutterFlow/update/new-debugging-section
Add Debugging Docs
2 parents f42601d + 14bb1f7 commit c0a2416

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed
65.7 KB
Binary file not shown.
91 KB
Binary file not shown.

docs/debugging/layout-errors.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
slug: /layout-errors
3+
title: Layout Errors
4+
description: Practical guidance for debugging layour errors in Dreamflow project.
5+
tags: [debugging]
6+
sidebar_position: 1
7+
keywords: [dreamflow debugging, layout error, agent prompt]
8+
---
9+
10+
# Layout Errors
11+
12+
## Renderflex Overflow Errors
13+
14+
A **Renderflex Overflow Error** occurs when a widget’s content is too large to fit within the available space on the screen or inside its parent widget.
15+
16+
Flutter tries to render all UI elements within fixed layout constraints, and when a widget exceeds those limits, it triggers an overflow, often shown as yellow and black striped bars on the screen and the error message like this in the debug console:
17+
18+
![overflow-error](imgs/overflow-error.avif)
19+
20+
Overflow errors typically happen due to one or more of the following reasons:
21+
22+
- A widget’s **content is larger** than the space provided by its parent (for example, long text inside a `Row` or a large image in a small `Container`).
23+
- A `Column` with too many child widgets that extend beyond the screen height.
24+
- Missing **scrollable widgets** like `SingleChildScrollView`, `ListView`, or `Expanded` when content should be scrollable or flexible.
25+
- Hard-coded **widths or heights** that don’t adapt to different screen sizes.
26+
- Nesting layout widgets (like `Row`, `Column`, or `Flex`) without proper constraints (`Expanded`, `Flexible`, etc.).
27+
28+
### Fixing Renderflex Overflow Errors
29+
30+
**Fix Manually**
31+
32+
Here are some quick tips to fix overflow errors manually:
33+
34+
- Use **`Expanded`** or **`Flexible`** widgets to make child widgets adapt to available space.
35+
- Wrap overflowing content in a **`SingleChildScrollView`** to make it scrollable.
36+
- Use **`TextOverflow.ellipsis`** or `maxLines` for long text content.
37+
- Avoid fixed widths/heights; use responsive layout helpers like `MediaQuery` or `LayoutBuilder`.
38+
39+
**Fix with Agent**
40+
41+
Dreamflow’s Agent can help you quickly identify and fix overflow errors. Here’s how to use it:
42+
43+
1. [**Take a screenshot**](../workspace/agent-panel.md#screenshot-mode) of your app preview showing the overflow error (yellow/black bars).
44+
2. **Describe the issue to the Agent.** Here’s an example prompt:
45+
46+
```
47+
I see an overflow error on the screen. Please check the console to find the widget causing it and adjust the layout to fix it.
48+
```
49+
50+
![fix-with-agent.avif](imgs/fix-with-agent.avif)
51+
52+
3. The **Agent will analyze the logs**, locate the widget and line number causing the overflow, and automatically adjust layout constraints, for example, by adding `Expanded`, `Flexible`, or scrollable containers where needed.
53+
4. Once the fix is applied, the agent will **rerun the preview,** and you can confirm if the overflow error is resolved.

sidebars.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ const sidebars: SidebarsConfig = {
5252
}
5353
],
5454
},
55+
{
56+
type: 'category',
57+
label: 'Debugging',
58+
collapsed: false,
59+
items: [
60+
{
61+
type: 'autogenerated',
62+
dirName: 'debugging',
63+
}
64+
],
65+
},
5566
]
5667

5768
};

0 commit comments

Comments
 (0)