moveLayerListPosition method
Moves a layer in the list to a new position.
oldIndex
is the current index of the layer.newIndex
is the desired index to move the layer to.
Implementation
void moveLayerListPosition({
required int oldIndex,
required int newIndex,
}) {
List<Layer> layers = _layerCopyManager.copyLayerList(activeLayers);
if (newIndex > oldIndex) {
var item = layers.removeAt(oldIndex);
layers.insert(newIndex - 1, item);
} else {
var item = layers.removeAt(oldIndex);
layers.insert(newIndex, item);
}
addHistory(layers: layers);
setState(() {});
}