public override void paintStack(PaintingContext context, Offset offset) { if (this.firstChild == null || this.index == null) { return; } RenderBox child = this._childAtIndex(); StackParentData childParentData = (StackParentData)child.parentData; context.paintChild(child, childParentData.offset + offset); }
protected override bool hitTestChildren(HitTestResult result, Offset position) { if (this.firstChild == null || this.index == null) { return(false); } D.assert(position != null); RenderBox child = this._childAtIndex(); StackParentData childParentData = (StackParentData)child.parentData; return(child.hitTest(result, position: position - childParentData.offset)); }
RenderBox _childAtIndex() { RenderBox child = firstChild; int i = 0; while (child != null && i < index) { StackParentData childParentData = (StackParentData)child.parentData; child = childParentData.nextSibling; i += 1; } D.assert(i == index); D.assert(child != null); return(child); }
protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null) { if (firstChild == null) { return(false); } D.assert(position != null); RenderBox child = _childAtIndex(); StackParentData childParentData = (StackParentData)child.parentData; return(result.addWithPaintOffset( offset: childParentData.offset, position: position, hitTest: (BoxHitTestResult resultIn, Offset transformed) => { D.assert(transformed == position - childParentData.offset); return child.hitTest(resultIn, position: transformed); } )); }