Features
You could use RelativeStack to position its children relative to you specify widget. (the specified widget is also one of the children list)
tag 1would be relative toRelativeStackself, and its center would be overlapped at the center ofRelativeStacktag 2would be relative totag 1, and itsbottomRightwould be overlapped at thetopLeftoftag 1tag 3would be also relative totag 1, and itstopLeftwould be overlapped at thecenteroftag 1and be shiftedOffset(-10, 10)absolutelytag 4would be relative toRelativeStackself, and itstopRightwould be aligned to thetopRightofRelativeStacktag 5would be also relative totag 1, and itstopCenterwould be aligned to thebottomCenteroftag 1tag 6is not wrapped inRelativePositioned, so it would be treated as a normal widget and painted from thetopLeftofRelativeStack
By using AnimatedRelative, you could animate your widget's position like AnimatedPositioned:

Questions
Why RelativePositioned/AnimatedRelative is overflowing
Truly, the RelativePositioned widgets may be outside of the Size of RelativeStack (overflowing) because they would only follow their RelativePositioned.relativeTo instead of relative to RelativeStack directly. Only those RelativePositioned that have no relativeTo property would be relative to RelativeStack directly.
Why the AnimatedRelative or RelativePositioned does not trigger gesture tapping events
If the AnimatedRelative or RelativePositioned is painted at the outside of the size of RelativeStack (it is possible because RelativeStack only ensure the widgets follow its target's position but not guarantee they are inside of its size), it cannot pass the hitTest due to the mechanism of Flutter hitTest:

Why AnimatedRelative would change the size of RelativeStack
since the size of RelativeStack is computed as below, so its size might be change during animation
How the size of RelativeStack is computed
Since the children list may contain normal widgets and RelativePositioned, so we follow the below rules to compute the size of RelativeStack.
- For all
RelativePositionedwidgets, we would abstract them as multi-node tree according to their relations defined byRelativePositioned.relativeTo. Afterlayouteach render box, we could know their actual size, and then, we go through their relation trees to compute their relativeSizes. Finally, we would compare theRelativeSizeof each relation tree by:
_RelativeSize compare(_RelativeSize other) {
return _RelativeSize()
..top = min(top, other.top)
..left = min(left, other.left)
..right = max(right, other.right)
..bottom = max(bottom, other.bottom);
}
to determine the maximum Size for all relation trees.
- for normal widgets, we do not need to process them particularly, and we could know their actual sizes instantly once
layoutthem.
Once we get all Sizes ready, we could compare them to determine the final Size for RelativeStack:
double width = idealRelativeSize.size.width;
double height = idealRelativeSize.size.height;
while (nonRelativeSizes.isNotEmpty) {
final childSize = nonRelativeSizes.removeLast();
width = max(childSize.width, width);
height = max(childSize.height, height);
}
size = constraints.constrain(Size(width, height));