text
stringlengths
1
372
to layout (such as centering, padding, rows, and columns).
the inspector helps you visualize and explore flutter widget
trees, and can be used for the following:
<topic_end>
<topic_start>
get started
to debug a layout issue, run the app in debug mode and
open the inspector by clicking the flutter inspector
tab on the DevTools toolbar.
info note
you can still access the flutter inspector directly from
android Studio/IntelliJ, but you might prefer the
more spacious view when running it from DevTools
in a browser.
<topic_end>
<topic_start>
debugging layout issues visually
the following is a guide to the features available in the
inspector’s toolbar. when space is limited, the icon is
used as the visual version of the label.
enable this button in order to select
a widget on the device to inspect it. for more information,
see inspecting a widget.
<topic_end>
<topic_start>
inspecting a widget
you can browse the interactive widget tree to view nearby
widgets and see their field values.
to locate individual UI elements in the widget tree,
click the select widget mode button in the toolbar.
this puts the app on the device into a “widget select” mode.
click any widget in the app’s UI; this selects the widget on the
app’s screen, and scrolls the widget tree to the corresponding node.
toggle the select widget mode button again to exit
widget select mode.
when debugging layout issues, the key fields to look at are the
size and constraints fields. the constraints flow down the tree,
and the sizes flow back up. for more information on how this works,
see understanding constraints.
<topic_end>
<topic_start>
flutter layout explorer
the flutter layout explorer helps you to better understand
flutter layouts.
for an overview of what you can do with this tool, see
the flutter explorer video:
you might also find the following step-by-step article useful:
<topic_end>
<topic_start>
using the layout explorer
from the flutter inspector, select a widget. the layout explorer
supports both flex layouts and fixed size layouts, and has
specific tooling for both kinds.
<topic_end>
<topic_start>
flex layouts
when you select a flex widget (for example, row, column, flex)
or a direct child of a flex widget, the flex layout tool will
appear in the layout explorer.
the layout explorer visualizes how flex widgets and their
children are laid out. the explorer identifies the main axis
and cross axis, as well as the current alignment for each
(for example, start, end, and spaceBetween).
it also shows details like flex factor, flex fit, and layout
constraints.
additionally, the explorer shows layout constraint violations
and render overflow errors. violated layout constraints
are colored red, and overflow errors are presented in the
standard “yellow-tape” pattern, as you might see on a running
device. these visualizations aim to improve understanding of
why overflow errors occur as well as how to fix them.
clicking a widget in the layout explorer mirrors
the selection on the on-device inspector. select widget mode
needs to be enabled for this. to enable it,
click on the select widget mode button in the inspector.
for some properties, like flex factor, flex fit, and alignment,
you can modify the value via dropdown lists in the explorer.
when modifying a widget property, you see the new value reflected
not only in the layout explorer, but also on the
device running your flutter app. the explorer animates
on property changes so that the effect of the change is clear.
widget property changes made from the layout explorer don’t
modify your source code and are reverted on hot reload.
<topic_end>
<topic_start>
interactive properties
layout explorer supports modifying mainAxisAlignment,
crossAxisAlignment, and FlexParentData.flex.
in the future, we may add support for additional properties
such as mainAxisSize, textDirection, and
FlexParentData.fit.
<topic_end>
<topic_start>
mainAxisAlignment
supported values:
<topic_end>
<topic_start>
crossAxisAlignment
supported values:
<topic_end>