paintOrder property

  1. @override
List<RenderBox> get paintOrder

The children in the order paint paints them, the first painted first: the atomic inlines and what is placed against the boxes in their groups' order (_paintGroups) -- a moved or faded box's after the rest, one faded to nothing where it would stand -- then what is placed against the boxes on no line. A child painted nowhere (hidden, or on no line) comes before them all, in the order the flow holds it. hitTestChildren asks them from the last: the one drawn on top takes the press.

Implementation

@override
List<RenderBox> get paintOrder {
  final kids = _children;
  final laid = _laid;
  final painted = <RenderBox>[];
  if (laid != null) {
    void walk(_PaintGroup g) {
      for (final i in g.ops) {
        if (laid.ops[i] case _AtomOp(:final atom) when atom < kids.length) painted.add(kids[atom]);
      }
      g.inner.forEach(walk);
      final kid = g.box == null ? null : _placedKids?[g.box];
      if (kid != null) painted.add(kid);
    }

    walk(_groupsOf(laid));
    for (final (kid, _) in _orphans ?? const <(RenderBox, double)>[]) {
      painted.add(kid);
    }
  }
  final seen = painted.toSet();
  return [
    for (final k in kids)
      if (!seen.contains(k)) k,
    ...painted,
  ];
}