handleDeviceOrientationChanged method

void handleDeviceOrientationChanged()

Resets all entities in childrenOrderMap and childrenKeyMap.

Clears offsetMap and rebuilds all entities in childrenOrderMap and childrenKeyMap because after the orientation change, the children will have new offsets that has to be recalculated.

Implementation

void handleDeviceOrientationChanged() {
  offsetMap.clear();

  for (final entry in childrenOrderMap.entries) {
    final value = entry.value;
    childrenOrderMap[entry.key] = ReorderableEntity.create(
      key: value.key,
      updatedOrderId: value.updatedOrderId,
    );
  }

  for (final entry in childrenKeyMap.entries) {
    final value = entry.value;
    childrenKeyMap[entry.key] = ReorderableEntity.create(
      key: value.key,
      updatedOrderId: value.updatedOrderId,
    );
  }
}