layout method

void layout(
  1. RenderBox child,
  2. Size size,
  3. int childCount, {
  4. double ratio = 1.0,
  5. required Axis axis,
})

different ActionLayoutDelegate may return different SizedConstraints in getSizedConstraints so that each action item could be laid out using s specific BoxConstraints and each action item would be positioned at a specific offset calculated by getRelativeOffset

Implementation

void layout(
  RenderBox child,
  Size size,
  int childCount, {
  double ratio = 1.0,
  required Axis axis,
}) {
  assert(childCount > 0);

  final sizedConstraints = getSizedConstraints(
    size: size,
    axis: axis,
    childCount: childCount,
  );

  RenderBox? current = child;

  int index = 0;

  while (current != null) {
    current.layout(sizedConstraints.constraints[index],
        parentUsesSize: false);

    final parentData = current.parentData as SlideActionBoxData;

    parentData.offset = getRelativeOffset(
      sizedConstraints: sizedConstraints,
      index: index,
      ratio: ratio,
    );
    current = parentData.nextSibling;
    index++;
  }
}