swap method
Swap the top-most Layer on the stack for the given layer
.
Implementation
void swap(Layer<T> layer) {
if (_layers.isNotEmpty) {
var top = _layers.removeLast();
top._unbindUi();
}
layer._bindUi(this);
_layers.add(layer);
dirty();
}