updated method

ReorderableEntity updated({
  1. required int updatedOrderId,
  2. required Offset? updatedOffset,
  3. required Size? size,
})

Implementation

ReorderableEntity updated({
  required int updatedOrderId,
  required Offset? updatedOffset,
  required Size? size,
}) {
  var originalOrderId = this.originalOrderId;
  var originalOffset = this.originalOffset;

  // should only update original when previous updated orderId is different to previous one
  if (updatedOrderId != this.updatedOrderId) {
    originalOrderId = this.updatedOrderId;
    originalOffset = this.updatedOffset;
  }

  return ReorderableEntity(
    key: key,
    originalOrderId: originalOrderId,
    updatedOrderId: updatedOrderId,
    originalOffset: originalOffset,
    updatedOffset: updatedOffset ?? this.updatedOffset,
    size: size ?? this.size,
    isBuildingOffset: updatedOffset == null,
    hasSwappedOrder:
        updatedOrderId != originalOrderId && updatedOffset != null,
  );
}