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;


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


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