RenderFlex class

A render object that displays its children in a flex layout

RenderFlex arranges its children in a line along the main axis (horizontal for Row, vertical for Column) and positions them according to the flex algorithm and alignment properties.

Inheritance

Constructors

RenderFlex({required Axis direction, MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start, MainAxisSize mainAxisSize = MainAxisSize.max, CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center, double? spacing, List<RenderBox>? children})
Create a flex render object

Properties

children List<RenderObject>
Child RenderObjects
finalinherited
childrenBoxes List<RenderBox>
Get all children as RenderBox objects
no setter
crossAxisAlignment CrossAxisAlignment
How the children should be placed along the cross axis
getter/setter pair
debugNeedsLayout bool
Whether this render object is waiting for layout.
no setterinherited
debugNeedsPaint bool
Whether this render object is waiting for paint.
no setterinherited
direction Axis
The direction to use as the main axis
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
height int
Height in terminal cells, assigned during layout.
getter/setter pairinherited
mainAxisAlignment MainAxisAlignment
How the children should be placed along the main axis
getter/setter pair
mainAxisSize MainAxisSize
How much space should be occupied in the main axis
getter/setter pair
parent RenderObject?
Parent RenderObject in the tree
getter/setter pairinherited
pipelineOwner → PipelineOwner?
The pipeline owner this render object is attached to, if any.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size Size
The current size of this box, or Size.zero if not laid out
getter/setter pairinherited
spacing double?
The amount of space to place between children in the main axis
getter/setter pair
width int
Width in terminal cells, assigned during layout.
getter/setter pairinherited
x int
Horizontal position in terminal cells, relative to the parent.
getter/setter pairinherited
y int
Vertical position in terminal cells, relative to the parent.
getter/setter pairinherited

Methods

add(RenderBox child, {int? flex, FlexFit? fit}) → void
Add a child to the end of the child list
addAll(List<RenderBox> children) → void
Add multiple children to the end of the child list
adoptChild(RenderObject child) → void
Add a child to this render object
inherited
attach(PipelineOwner owner) → void
Attach this render object and its existing children to owner.
inherited
detach() → void
Called when the render object is detached from the render tree.
inherited
dropChild(RenderObject child) → void
Remove a child from this render object
inherited
getConstraintsForChild(RenderBox child, BoxConstraints constraints) BoxConstraints
Get the constraints that should be applied to children
inherited
hitTest(HitTestResult result, Offset position) bool
Hit-test this render object using position in local coordinates.
inherited
hitTestChildren(HitTestResult result, Offset position) bool
Hit-test children in reverse paint order.
inherited
hitTestSelf(Offset position) bool
Whether this box should add itself to a hit-test path.
inherited
layout(Constraints constraints) → void
Entry point for layout.
inherited
markNeedsLayout() → void
Mark this render object as needing layout and paint.
inherited
markNeedsPaint() → void
Mark this render object as needing paint.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
paint(PaintingContext context, Offset offset) → void
Default paint implementation.
inherited
performBoxLayout(BoxConstraints constraints) → void
Perform layout with typed box constraints
override
performLayout(Constraints constraints) → void
Perform layout with box constraints
inherited
positionChild(RenderBox child, int x, int y) → void
Position a child within this box
inherited
remove(RenderBox child) → void
Remove a child from the child list
toString() String
A string representation of this object.
inherited
visitChildren(void visitor(RenderObject child)) → void
Visit all children with a callback
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited