Beispiel #1
0
        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);
        }
Beispiel #2
0
        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));
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
            }
                       ));
        }