Skip to content

Latest commit

 

History

History
23 lines (19 loc) · 2.82 KB

File metadata and controls

23 lines (19 loc) · 2.82 KB

Flow Layout

A widget that sizes and positions children efficiently, according to the logic in a FlowDelegate.

Flow layouts are optimized for repositioning children using transformation matrices.

The flow container is sized independently from the children by the FlowDelegate.getSize function of the delegate. The children are then sized independently given the constraints from the FlowDelegate.getConstraintsForChild function.

Rather than positioning the children during layout, the children are positioned using transformation matrices during the paint phase using the matrices from the FlowDelegate.paintChildren function. The children can be repositioned efficiently by only repainting the flow, which happens without the children being laid out again (contrast this with a Stack, which does the sizing and positioning together during layout).

The most efficient way to trigger a repaint of the flow is to supply an animation to the constructor of the FlowDelegate. The flow will listen to this animation and repaint whenever the animation ticks, avoiding both the build and layout phases of the pipeline.

A widget that displays its children in multiple horizontal or vertical runs.

A Wrap lays out each child and attempts to place the child adjacent to the previous child in the main axis, given by direction, leaving spacing space in between. If there is not enough space to fit the child, Wrap creates a new run adjacent to the existing children in the cross axis.

After all the children have been allocated to runs, the children within the runs are positioned according to the alignment in the main axis and according to the crossAxisAlignment in the cross axis.

The runs themselves are then positioned in the cross axis according to the runSpacing and runAlignment.