The Flutter rendering tree.

To use, import package:flutter/rendering.dart.

The RenderObject hierarchy is used by the Flutter Widgets library to implement its layout and painting back-end. Generally, while you may use custom RenderBox classes for specific effects in your applications, most of the time your only interaction with the RenderObject hierarchy will be in debugging layout issues.

If you are developing your own library or application directly on top of the rendering library, then you will want to have a binding (see BindingBase). You can use RenderingFlutterBinding, or you can create your own binding. If you create your own binding, it needs to import at least SchedulerBinding, GestureBinding, ServicesBinding, and RendererBinding. The rendering library does not automatically create a binding, but relies on one being initialized with those features.

Typedefs

InformationCollector(StringBuffer information) → void

Signature for FlutterErrorDetails.informationCollector callback and other callbacks that collect information into a string buffer.

LayoutCallback(Constraints constraints) → void

Signature for a function that is called during layout.

PaintingContextCallback(PaintingContext context, Offset offset) → void

Signature for painting into a PaintingContext.

PointerCancelEventListener(PointerCancelEvent event) → void

Signature for listening to PointerCancelEvent events.

PointerDownEventListener(PointerDownEvent event) → void

Signature for listening to PointerDownEvent events.

PointerMoveEventListener(PointerMoveEvent event) → void

Signature for listening to PointerMoveEvent events.

PointerUpEventListener(PointerUpEvent event) → void

Signature for listening to PointerUpEvent events.

RenderEditablePaintOffsetNeededCallback(ViewportDimensions dimensions, Rect caretRect) Offset

Signature for the callback used by RenderEditable to determine the paint offset when the dimensions of the render box change.

RenderObjectVisitor(RenderObject child) → void

Signature for a function that is called for each RenderObject.

SelectionChangedHandler(TextSelection selection, RenderEditable renderObject, bool longPress) → void

Signature for the callback that reports when the user changes the selection (including the cursor location).

SemanticsAnnotator(SemanticsNode semantics) → void

The type of function returned by RenderObject.getSemanticsAnnotators().

SemanticsNodeVisitor(SemanticsNode node) bool

Signature for a function that is called for each SemanticsNode.

ShaderCallback(Rect bounds) Shader

Signature for a function that creates a Shader for a given Rect.

ValueChanged(T value) → void

Signature for callbacks that report that an underlying value has changed.

ValueGetter() → T

Signature for callbacks that are to report a value on demand.

ValueSetter(T value) → void

Signature for callbacks that report that a value has been set.

ViewportDimensionsChangeCallback(ViewportDimensions dimensions) Offset

Signature for notifications about RenderViewport dimensions changing.

VoidCallback() → void

Signature of callbacks that have no arguments and return no data.

Properties

debugCheckIntrinsicSizes bool

Check the intrinsic sizes of each RenderBox during layout.

read / write
debugCurrentRepaintColor HSVColor

The current color to overlay when repainting a layer.

read / write
debugPaintAlphabeticBaselineColor Color

The color to use when painting alphabetic baselines.

read / write
debugPaintArrowColor Color

The color to use when painting the arrows used to show RenderPositionedBox alignment.

read / write
debugPaintBaselinesEnabled bool

Causes each RenderBox to paint a line at each of its baselines.

read / write
debugPaintIdeographicBaselineColor Color

The color ot use when painting ideographic baselines.

read / write
debugPaintLayerBordersColor Color

The color to use when painting Layer borders.

read / write
debugPaintLayerBordersEnabled bool

Causes each Layer to paint a box around its bounds.

read / write
debugPaintPaddingColor Color

The color to use when painting RenderPadding edges.

read / write
debugPaintPaddingInnerEdgeColor Color

The color to use when painting RenderPadding edges.

read / write
debugPaintPointersColorValue int

The color to use when reporting pointers for debugPaintPointersEnabled.

read / write
debugPaintPointersEnabled bool

Causes objects like RenderPointerListener to flash while they are being tapped. This can be useful to see how large the hit box is, e.g. when debugging buttons that are harder to hit than expected.

read / write
debugPaintSizeColor Color

The color to use when painting RenderObject bounds.

read / write
debugPaintSizeEnabled bool

Causes each RenderBox to paint a box around its bounds, and some extra boxes, such as RenderPadding, to draw construction lines.

read / write
debugPaintSpacingColor Color

The color to use when painting some boxes that just add space (e.g. an empty RenderConstrainedBox or RenderPadding).

read / write
debugPrint DebugPrintCallback

Prints a message to the console, which you can access using the "flutter" tool's "logs" command ("flutter logs").

read / write
debugPrintMarkNeedsLayoutStacks bool

Log the call stacks that mark render objects as needing layout.

read / write
debugPrintMarkNeedsPaintStacks bool

Log the call stacks that mark render objects as needing paint.

read / write
debugProfilePaintsEnabled bool

Adds Timeline events for every RenderObject painted.

read / write
debugRepaintRainbowEnabled bool

Overlay a rotating set of colors when repainting layers in checked mode.

read / write
debugRepaintRainbowHueIncrement double

The amount to increment the hue of the current repaint color.

read / write

Functions

applyImageFit(ImageFit fit, Size inputSize, Size outputSize) FittedSizes

Apply an ImageFit value.

debugAssertAllRenderVarsUnset(String reason) bool

Returns true if none of the rendering library debug variables have been changed.

debugDescribeTransform(Matrix4 transform) List<String>

Returns a list of strings representing the given transform in a format useful for RenderObject.debugFillDescription.

debugDumpLayerTree() → void

Prints a textual representation of the entire layer tree.

debugDumpRenderTree() → void

Prints a textual representation of the entire render tree.

debugDumpSemanticsTree() → void

Prints a textual representation of the entire semantics tree. This will only work if there is a semantics client attached. Otherwise, the tree is empty and this will print "null".

hashList(Iterable<Object> args) int

Combine the hashCodes of an arbitrary number of values from an Iterable into one value. This function will return the same value if given "null" as if given an empty list.

hashValues(Object arg01, Object arg02, [ Object arg03 = _hashEnd, Object arg04 = _hashEnd, Object arg05 = _hashEnd, Object arg06 = _hashEnd, Object arg07 = _hashEnd, Object arg08 = _hashEnd, Object arg09 = _hashEnd, Object arg10 = _hashEnd, Object arg11 = _hashEnd, Object arg12 = _hashEnd, Object arg13 = _hashEnd, Object arg14 = _hashEnd, Object arg15 = _hashEnd, Object arg16 = _hashEnd, Object arg17 = _hashEnd, Object arg18 = _hashEnd, Object arg19 = _hashEnd, Object arg20 = _hashEnd ]) int

Combine up to twenty values' hashCodes into one value.

paintImage({Canvas canvas, Rect rect, Image image, ColorFilter colorFilter, ImageFit fit, ImageRepeat repeat: ImageRepeat.noRepeat, Rect centerSlice, FractionalOffset alignment }) → void

Paints an image into the given rectangle in the canvas.

Enums

Axis

The two cardinal directions in two dimensions.

BlurStyle

Styles to use for blurs in MaskFilter objects.

BorderStyle

The style of line to draw for a BorderSide in a Border.

BoxShape

The shape to use when rendering a BoxDecoration.

CrossAxisAlignment

How the children should be placed along the cross axis in a flex layout.

DecorationPosition

Where to paint a box decoration.

FilterQuality

Quality levels for image filters.

FlexFit

How the child is inscribed into the available space.

FlutterLogoStyle

Possible ways to draw Flutter's logo.

FontStyle

Whether to slant the glyphs in the font

HitTestBehavior

How to behave during hit tests.

ImageFit

How an image should be inscribed into a box.

ImageRepeat

How to paint any portions of a box not covered by an image.

MainAxisAlignment

How the children should be placed along the main axis in a flex layout.

MainAxisSize

How much space space should be occupied in the main axis.

Overflow

Whether overflowing children should be clipped, or their overflow be visible.

PaintingStyle

Strategies for painting shapes and paths on a canvas.

PerformanceOverlayOption

The options that control whether the performance overlay displays certain aspects of the compositor.

StrokeCap

Styles to use for line endings.

TableCellVerticalAlignment

Vertical alignment options for cells in RenderTable objects.

TextAffinity

Whether a TextPosition is visually upstream or downstream of its offset.

TextAlign

Whether to align text horizontally

TextBaseline

A horizontal line used for aligning text

TextDecorationStyle

The style in which to draw a text decoration

TextDirection

A direction in which text flows.

TextOverflow

How overflowing text should be handled.

TileMode

Defines what happens at the edge of the gradient.

TransferMode

Algorithms to use when painting on the canvas.

VertexMode

Defines how a list of points is interpreted when drawing a set of triangles.

ViewportAnchor

The end of the viewport from which the paint offset is computed.

Classes

AbstractNode

An abstract node in a tree.

AutoLayoutDelegate

Subclass to control the layout of a RenderAutoLayout.

AutoLayoutParentData

Parent data for use with RenderAutoLayout.

AutoLayoutRect

Hosts the edge parameters and vends useful methods to construct expressions for constraints. Also sets up and manages implicit constraints and edit variables.

BackdropFilterLayer

A composited layer that applies a filter to the existing contents of the scene.

BackgroundImage

A background image for a box.

BlockParentData

Parent data for use with RenderBlockBase.

Border

A border of a box, comprised of four sides.

BorderRadius

An immutable set of radii for each corner of a rectangle.

BorderSide

A side of a border of a box.

BoxConstraints

Immutable layout constraints for box layout.

BoxDecoration

An immutable description of how to paint a box.

BoxHitTestEntry

A hit test entry used by RenderBox.

BoxPainter

A stateful class that can paint a particular Decoration.

BoxParentData

Parent data used by RenderBox and its subclasses.

BoxShadow

A shadow cast by a box.

Canvas

An interface for recording graphical operations.

ClipPathLayer

A composite layer that clips its children using a path

ClipRectLayer

A composite layer that clips its children using a rectangle

ClipRRectLayer

A composite layer that clips its children using a rounded rectangle

Color

An immutable 32 bit color value in ARGB

ColorFilter

A description of a color filter to apply when drawing a shape or compositing a layer with a particular Paint. A color filter is a function that takes two colors, and outputs one color. When applied during compositing, it is independently applied to each pixel of the layer being drawn before the entire layer is merged with the destination.

Constraints

An abstract set of layout constraints.

ContainerBoxParentDataMixin

Abstract ParentData subclass for RenderBox subclasses that want the ContainerRenderObjectMixin.

ContainerLayer

A composited layer that has a list of children

ContainerParentDataMixin

Parent data to support a doubly-linked list of children.

ContainerRenderObjectMixin

Generic mixin for render objects with a list of children.

CustomClipper

An interface for providing custom clips.

CustomPainter

The interface used by CustomPaint (in the widgets library) and RenderCustomPaint (in the rendering library).

Decoration

A description of a box decoration (a decoration applied to a Rect).

EdgeInsets

An immutable set of offsets in each of the four cardinal directions.

FittedSizes

The pair of sizes returned by applyImageFit.

FixedColumnCountGridDelegate

A GridDelegate that divides the grid's width evenly for a fixed number of columns.

FixedColumnWidth

Sizes the column to a specific number of pixels.

FlexColumnWidth

Sizes the column by taking a part of the remaining space once all the other columns have been laid out.

FlexParentData

Parent data for use with RenderFlex.

FlowDelegate

A delegate that controls the appearance of a flow layout.

FlowPaintingContext

A context in which a FlowDelegate paints.

FlowParentData

Parent data for use with RenderFlow.

FlutterErrorDetailsForRendering

Variant of FlutterErrorDetails with extra fields for the rendering library.

FlutterLogoDecoration

An immutable description of how to paint Flutter's logo.

FontWeight

The thickness of the glyphs used to draw the text

FractionalOffset

An offset that's expressed as a fraction of a Size.

FractionalOffsetTween

An interpolation between two fractional offsets.

FractionColumnWidth

Sizes the column to a fraction of the table's constraints' maxWidth.

Gradient

A 2D gradient.

GridChildPlacement

Where to place a child within a grid.

GridDelegate

An abstract interface to control the layout of a RenderGrid.

GridDelegateWithInOrderChildPlacement

A GridDelegate the places its children in order throughout the grid.

GridParentData

Parent data for use with RenderGrid

GridSpecification

Specifies the geometry of tiles in a grid.

HitTestEntry

Data collected during a hit test about a specific HitTestTarget.

HitTestResult

The result of performing a hit test.

HSVColor

A color represented using alpha, hue, saturation, and value.

ImageConfiguration

Configuration information passed to the ImageProvider.resolve method to select a specific image.

ImageShader

A shader (as used by Paint.shader) that tiles an image.

IntrinsicColumnWidth

Sizes the column according to the intrinsic dimensions of all the cells in that column.

Layer

A composited layer.

LinearGradient

A 2D linear gradient.

ListParentData

Parent data for use with RenderList.

MaskFilter

A mask filter to apply to shapes as they are painted. A mask filter is a function that takes a bitmap of color pixels, and returns another bitmap of color pixels.

Matrix4

4D Matrix. Values are stored in column major order.

MatrixUtils

Utility functions for working with matrices.

MaxColumnWidth

Sizes the column such that it is the size that is the maximum of two column width specifications.

MaxTileWidthGridDelegate

A GridDelegate that fills the width with a variable number of tiles.

MinColumnWidth

Sizes the column such that it is the size that is the minimum of two column width specifications.

MultiChildLayoutDelegate

A delegate that controls the layout of multiple children.

MultiChildLayoutParentData

ParentData used by RenderCustomMultiChildLayoutBox.

Offset

An immutable 2D floating-point offset.

OffsetLayer

A layer that is displayed at an offset from its parent layer.

OpacityLayer

A composited layer that makes its children partially transparent

Paint

A description of the style to use when drawing on a Canvas.

PaintingContext

A place to paint.

ParentData

Base class for data associated with a RenderObject by its parent.

Path

A complex, one-dimensional subset of a plane.

PerformanceOverlayLayer

A layer that indicates to the compositor that it should display certain performance statistics within it.

PictureLayer

A composited layer containing a Picture

PipelineOwner

The pipeline owner manages the rendering pipeline.

Point

An immutable 2D floating-point x,y coordinate pair.

PointerCancelEvent

The input from the pointer is no longer directed towards this receiver.

PointerDownEvent

The pointer has made contact with the device.

PointerEvent

Base class for touch, stylus, or mouse events.

PointerMoveEvent

The pointer has moved with respect to the device while the pointer is in contact with the device.

PointerUpEvent

The pointer has stopped making contact with the device.

RadialGradient

A 2D radial gradient.

Radius

A radius for either circular or elliptical shapes.

Rect

An immutable 2D, axis-aligned, floating-point rectangle whose coordinates are relative to an origin point.

RelativeRect

An immutable 2D, axis-aligned, floating-point rectangle whose coordinates are given relative to another rectangle's edges, known as the container. Since the dimensions of the rectangle are relative to those of the container, this class has no width and height members. To determine the width or height of the rectangle, convert it to a Rect using toRect() (passing the container's own Rect), and then examine that object.

RenderAbsorbPointer

A render object that absorbs pointers during hit testing.

RenderAligningShiftedBox

Abstract class for one-child-layout render boxes that use a FractionalOffset to align their children.

RenderAnimatedSize

A render object that animates its size to its child's size over a given duration and with a given curve. If the child's size itself animates (i.e. if it changes size two frames in a row, as opposed to abruptly changing size in one frame then remaining that size in subsequent frames), this render object sizes itself to fit the child instead of animating itself.

RenderAspectRatio

Attempts to size the child to a specific aspect ratio.

RenderAutoLayout

A render object that uses the cassowary constraint solver to automatically size and position children.

RenderBackdropFilter

Applies a filter to the existing painted content and then paints child.

RenderBaseline

Shifts the child down such that the child's baseline (or the bottom of the child, if the child has no baseline) is baseline logical pixels below the top of this box, then sizes this box to contain the child.

RenderBlock

Implements the block layout algorithm.

RenderBox

A render object in a 2D cartesian coordinate system.

RenderBoxContainerDefaultsMixin

A mixin that provides useful default behaviors for boxes with children managed by the ContainerRenderObjectMixin mixin.

RenderClipOval

Clips its child using an oval.

RenderClipPath

Clips its child using a path.

RenderClipRect

Clips its child using a rectangle.

RenderClipRRect

Clips its child using a rounded rectangle.

RenderConstrainedBox

Imposes additional constraints on its child.

RenderConstrainedOverflowBox

A render object that imposes different constraints on its child than it gets from its parent, possibly allowing the child to overflow the parent.

RenderCustomMultiChildLayoutBox

Defers the layout of multiple children to a delegate.

RenderCustomPaint

Provides a canvas on which to draw during the paint phase.

RenderCustomSingleChildLayoutBox

Defers the layout of its single child to a delegate.

RenderDecoratedBox

Paints a Decoration either before or after its child paints.

RenderEditable

A single line of editable text.

RendererBinding

The glue between the render tree and the Flutter engine.

RenderErrorBox

A render object used as a placeholder when an error occurs.

RenderExcludeSemantics

Excludes this subtree from the semantic tree.

RenderFittedBox

Scales and positions its child within itself according to fit.

RenderFlex

Displays its children in a one-dimensional array.

RenderFlow

Implements the flow layout algorithm.

RenderFractionallySizedOverflowBox

Sizes its child to a fraction of the total available space.

RenderFractionalTranslation

Applies a translation transformation before painting its child.

RenderGrid

Implements the grid layout algorithm

RenderIgnorePointer

A render object that is invisible during hit testing.

RenderImage

An image in the render tree.

RenderIndexedStack

Implements the same layout algorithm as RenderStack but only paints the child specified by index.

RenderingFlutterBinding

A concrete binding for applications that use the Rendering framework directly. This is the glue that binds the framework to the Flutter engine.

RenderIntrinsicHeight

Sizes its child to the child's intrinsic height.

RenderIntrinsicWidth

Sizes its child to the child's intrinsic width.

RenderLimitedBox

Constrains the child's maxWidth and maxHeight if they're otherwise unconstrained.

RenderList

A linear layout of children intended for use as a virtual viewport.

RenderMergeSemantics

Causes the semantics of all descendants to be merged into this node such that the entire subtree becomes a single leaf in the semantics tree.

RenderMetaData

Holds opaque meta data in the render tree.

RenderObject

An object in the render tree.

RenderObjectWithChildMixin

Generic mixin for render objects with one child.

RenderOffstage

Lays the child out as if it was in the tree, but without painting anything, without making the child available for hit testing, and without taking any room in the parent.

RenderOpacity

Makes its child partially transparent.

RenderPadding

Insets its child by the given padding.

RenderParagraph

A render object that displays a paragraph of text

RenderPerformanceOverlay

Displays performance statistics.

RenderPointerListener

Calls callbacks in response to pointer events.

RenderPositionedBox

Positions its child using a FractionalOffset.

RenderProxyBox

A base class for render objects that resemble their children.

RenderProxyBoxMixin

Implementation of RenderProxyBox.

RenderProxyBoxWithHitTestBehavior

A RenderProxyBox subclass that allows you to customize the hit-testing behavior.

RenderRepaintBoundary

Creates a separate display list for its child.

RenderRotatedBox

Rotates its child by a integral number of quarter turns.

RenderSemanticsAnnotations

Add annotations to the SemanticsNode for this subtree.

RenderSemanticsGestureHandler

Listens for the specified gestures from the semantics server (e.g. an accessibility tool).

RenderShaderMask

Applies a mask generated by a Shader to its child.

RenderShiftedBox

Abstract class for one-child-layout render boxes that provide control over the child's position.

RenderSizedOverflowBox

A render box that is a specific size but passes its original constraints through to its child, which will probably overflow.

RenderStack

Implements the stack layout algorithm

RenderTable

A table where the columns and rows are sized to fit the contents of the cells.

RenderTransform

Applies a transformation before painting its child.

RenderView

The root of the render tree.

RenderViewport

A render object that's bigger on the inside.

RenderViewportBase

A base class for render objects that are bigger on the inside.

RenderVirtualViewport

A render object that shows a subset of its children.

RRect

A rounded rectangle with the custom radii for all four corners.

RSTransform

A transform consisting of a translation, a rotation, and a uniform scale.

SemanticsAction

The possible actions that can be conveyed from the operating system accessibility APIs to a semantics node.

SemanticsActionHandler

Interface for RenderObjects to implement when they want to support being tapped, etc.

SemanticsData

Summary information about a SemanticsNode object.

SemanticsHandle

SemanticsNode

A node that represents some semantic data.

SemanticsOwner

Owns SemanticsNode objects and notifies listeners of changes to the render tree semantics.

Shader

Base class for objects such as Gradient and ImageShader which correspond to shaders as used by Paint.shader.

ShaderMaskLayer

A composited layer that applies a shader to hits children.

SingleChildLayoutDelegate

A delegate for computing the layout of a render object with a single child.

Size

Holds a 2D floating-point size.

StackParentData

Parent data for use with RenderStack.

TableBorder

Border specification for RenderTable.

TableCellParentData

Parent data used by RenderTable for its children.

TableColumnWidth

Base class to describe how wide a column in a RenderTable should be.

TextDecoration

A linear decoration to draw near the text

TextPainter

An object that paints a TextSpan tree into a Canvas.

TextPosition

A visual position in a string of text.

TextRange

A range of characters in a string of text.

TextSelection

A range of text that represents a selection.

TextSelectionPoint

Represents a global screen coordinate of the point in a selection, and the text direction at that point.

TextSpan

An immutable span of text.

TextStyle

An immutable style in which paint text.

TransformLayer

A composited layer that applies a transformation matrix to its children

ViewConfiguration

The layout constraints for the root render object.

ViewportDimensions

The interior and exterior dimensions of a viewport.

Exceptions / Errors

FlutterError

Error class used to report Flutter-specific assertion failures and contract violations.