positionChild method

void positionChild(
  1. Object childId,
  2. Offset offset
)

Specify the child's origin relative to this origin.

Call this from your performLayout function to position each child. If you do not call this for a child, its position will remain unchanged. Children initially have their position set to (0,0), i.e. the top left of the RenderCustomMultiChildLayoutBox.

Implementation

void positionChild(Object childId, Offset offset) {
  final RenderBox? child = _idToChild![childId];
  assert(() {
    if (child == null) {
      throw FlutterError(
        'The $this custom multichild layout delegate tried to position out a non-existent child:\n'
        'There is no child with the id "$childId".',
      );
    }
    return true;
  }());
  final MultiChildLayoutParentData childParentData = child!.parentData! as MultiChildLayoutParentData;
  childParentData.offset = offset;
}