Skip to content

Commit d7e592c

Browse files
committed
Add debugging docs
1 parent f42601d commit d7e592c

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed

docs/debugging/debugging.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
slug: /debugging
3+
title: Debugging
4+
description: Practical guidance for debugging project code with Dreamflow agent.
5+
tags: [debugging]
6+
sidebar_position: 1
7+
keywords: [dreamflow debugging, error tracing, agent prompt, generated code, logging]
8+
---
9+
10+
# Debugging
11+
12+
## Layout Issues
13+
14+
### Overflow Errors
15+
16+
An **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.
17+
18+
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:
19+
20+
```
21+
A RenderFlex overflowed by 28 pixels on the bottom.
22+
```
23+
24+
#### Why Overflow Errors Occur
25+
26+
Overflow errors typically happen due to one or more of the following reasons:
27+
28+
- 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`).
29+
- Missing **scrollable widgets** like `SingleChildScrollView`, `ListView`, or `Expanded` when content should be scrollable or flexible.
30+
- Hard-coded **widths or heights** that don’t adapt to different screen sizes.
31+
- Nesting layout widgets (like `Row`, `Column`, or `Flex`) without proper constraints (`Expanded`, `Flexible`, etc.).
32+
33+
#### Common Examples
34+
35+
- A `Row` containing multiple `Text` widgets with long strings and no wrapping.
36+
- A `Column` with too many child widgets that extend beyond the screen height.
37+
- Fixed-size containers that don’t resize on smaller devices.
38+
39+
#### How to Fix Overflow Errors
40+
41+
Here are some quick tips to fix overflow errors manually:
42+
43+
- Use **`Expanded`** or **`Flexible`** widgets to make child widgets adapt to available space.
44+
- Wrap overflowing content in a **`SingleChildScrollView`** to make it scrollable.
45+
- Use **`TextOverflow.ellipsis`** or `maxLines` for long text content.
46+
- Avoid fixed widths/heights; use responsive layout helpers like `MediaQuery` or `LayoutBuilder`.
47+
48+
#### Using Agent to Fix Overflow Errors
49+
50+
Dreamflow’s Agent can help you quickly identify and fix overflow errors.
51+
52+
**Here’s how to use it:**
53+
54+
1. [**Take a screenshot**](../workspace/agent-panel.md#screenshot-mode) of your app preview showing the overflow error (yellow/black bars).
55+
2. **Describe the issue to the Agent.** Here’s an example prompt:
56+
57+
```
58+
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.
59+
```
60+
61+
![fix-with-agent.avif](imgs/fix-with-agent.avif)
62+
63+
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.
64+
4. Once the fix is applied, the agent will **rerun the preview,** and you can confirm if the overflow error is resolved.
65.7 KB
Binary file not shown.

sidebars.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const sidebars: SidebarsConfig = {
5252
}
5353
],
5454
},
55+
'debugging/debugging',
5556
]
5657

5758
};

0 commit comments

Comments
 (0)