handleCreatedChild method

ReorderableEntity handleCreatedChild({
  1. required Offset? offset,
  2. required Size size,
  3. required ReorderableEntity reorderableEntity,
})

Updates specific values of reorderableEntity and update maps.

When the child was created, offset will be added to offsetMap to simplify the access to the offset of the order id of reorderableEntity.

Then #creationFinished is called that updates some important values.

In the end, the childrenOrderMap and childrenKeyMap are updated.

Implementation

ReorderableEntity handleCreatedChild({
  required Offset? offset,
  required Size size,
  required ReorderableEntity reorderableEntity,
}) {
  final existingReorderableEntity = _getExistingEntityWhileDragging(
    reorderableEntity: reorderableEntity,
    isBuildingOffset: true,
  );
  if (existingReorderableEntity != null) return existingReorderableEntity;

  if (offset != null) {
    offsetMap[reorderableEntity.updatedOrderId] = offset;
  }
  final updatedEntity = reorderableEntity.creationFinished(
    offset: offset,
    size: size,
  );
  _updateMaps(reorderableEntity: updatedEntity);

  return updatedEntity;
}