Greg Price b90818ec53
Control paint order / z-order of slivers (#164818)
Fixes #145592.

When slivers in a CustomScrollView overlap, this makes it possible to
control which of the slivers will sit in front of the other one, meaning
that it paints last and gets hit-tested first.

In this version there are two choices: the first sliver paints in front,
or the last sliver paints in front. The first sliver in front is the
default; it's the behavior needed for SliverAppBar, or other situations
where the first sliver is some sort of header.

The existing behavior is actually quite a bit more complicated than
that, with the "center" sliver painting in front, plus it varies
depending on `shrinkWrap`. As far as I can tell this behavior isn't
documented anywhere. It's equivalent to first-sliver-in-front whenever
`CustomScrollView.center` isn't being used; and in fact there don't seem
to be any tests in the tree that notice the difference between the
existing behavior and first-sliver-in-front.

So although I actually have an implementation that preserves the more
complex existing defaults, I'm hopeful we won't need it: if neither
google3 nor customer tests are relying on that undocumented distinction
either, then we can go ahead and simplify this behavior without a
breaking change.
2025-04-25 21:36:20 +00:00
..