text
stringlengths
1
474
(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>
<topic_start>FlexParentData.flex
Layout Explorer supports 7 flex options in the UI
(null, 0, 1, 2, 3, 4, 5), but technically the flex
factor of a flex widget’s child can be any int.<topic_end>
<topic_start>Flexible.fit
Layout Explorer supports the two different types of
FlexFit: loose and tight.<topic_end>
<topic_start>Fixed size layouts
When you select a fixed size widget that is not a child
of a flex widget, fixed size layout information will appear
in the Layout Explorer. You can see size, constraint, and padding
information for both the selected widget and its nearest upstream
RenderObject.<topic_end>
<topic_start>
Visual debugging
The Flutter Inspector provides several options for visually debugging your app.<topic_end>
<topic_start>
Slow animations
When enabled, this option runs animations 5 times slower for easier visual
inspection.
This can be useful if you want to carefully observe and tweak an animation that
doesn’t look quite right.This can also be set in code:
<code_start>import 'package:flutter/scheduler.dart';
void setSlowAnimations() {
timeDilation = 5.0;
}<code_end>
This slows the animations by 5x.<topic_end>
<topic_start>See also
The following links provide more info.The following screen recordings show before and after slowing an animation.
<topic_end>
<topic_start>
Show guidelines
This feature draws guidelines over your app that display render boxes, alignments,
paddings, scroll views, clippings and spacers.This tool can be used for better understanding your layout. For instance,
by finding unwanted padding or understanding widget alignment.You can also enable this in code:
<code_start>import 'package:flutter/rendering.dart';
void showLayoutGuidelines() {
debugPaintSizeEnabled = true;
}<code_end>
<topic_end>
<topic_start>Render boxes
Widgets that draw to the screen create a render box, the
building blocks of Flutter layouts. They’re shown with a bright blue border:<topic_end>
<topic_start>Alignments
Alignments are shown with yellow arrows. These arrows show the vertical
and horizontal offsets of a widget relative to its parent.
For example, this button’s icon is shown as being centered by the four arrows:<topic_end>
<topic_start>Padding
Padding is shown with a semi-transparent blue background:<topic_end>
<topic_start>Scroll views
Widgets with scrolling contents (such as list views) are shown with green arrows:<topic_end>
<topic_start>Clipping
Clipping, for example when using the ClipRect widget, are shown
with a dashed pink line with a scissors icon:<topic_end>
<topic_start>Spacers
Spacer widgets are shown with a grey background,
such as this SizedBox without a child:<topic_end>
<topic_start>
Show baselines
This option makes all baselines visible.
Baselines are horizontal lines used to position text.This can be useful for checking whether text is precisely aligned vertically.
For example, the text baselines in the following screenshot are slightly misaligned:The Baseline widget can be used to adjust baselines.A line is drawn on any render box that has a baseline set;
alphabetic baselines are shown as green and ideographic as yellow.You can also enable this in code:
<code_start>import 'package:flutter/rendering.dart';
void showBaselines() {
debugPaintBaselinesEnabled = true;
}<code_end>
<topic_end>
<topic_start>
Highlight repaints
This option draws a border around all render boxes
that changes color every time that box repaints.This rotating rainbow of colors is useful for finding parts of your app