zPosition property

double zPosition

The draw order of this node compared to its parent and its siblings.

By default nodes are drawn in the order that they have been added to a parent. To override this behavior the zPosition property can be used. A higher value of this property will force the node to be drawn in front of siblings that have a lower value. If a negative value is used the node will be drawn behind its parent.

nodeInFront.zPosition = 1.0;
nodeBehind.zPosition = -1.0;

Implementation

double get zPosition => _zPosition;
void zPosition=(double zPosition)

Implementation

set zPosition(double zPosition) {
  _zPosition = zPosition;
  if (_parent != null) {
    _parent!._childrenNeedSorting = true;
  }
}