protected override void performLayout() { BoxConstraints constraints = this.constraints; bool hasDivider = contentSection.getMaxIntrinsicHeight(constraints.maxWidth) > 0.0f && actionsSection.getMaxIntrinsicHeight(constraints.maxWidth) > 0.0f; float dividerThickness = hasDivider ? _dividerThickness : 0.0f; float minActionsHeight = actionsSection.getMinIntrinsicHeight(constraints.maxWidth); contentSection.layout( constraints.deflate(EdgeInsets.only(bottom: minActionsHeight + dividerThickness)), parentUsesSize: true ); Size contentSize = contentSection.size; actionsSection.layout( constraints.deflate(EdgeInsets.only(top: contentSize.height + dividerThickness)), parentUsesSize: true ); Size actionsSize = actionsSection.size; float actionSheetHeight = contentSize.height + dividerThickness + actionsSize.height; size = new Size(constraints.maxWidth, actionSheetHeight); D.assert(actionsSection.parentData is MultiChildLayoutParentData); MultiChildLayoutParentData actionParentData = actionsSection.parentData as MultiChildLayoutParentData; actionParentData.offset = new Offset(0.0f, contentSize.height + dividerThickness); }
public override void paint(PaintingContext context, Offset offset) { MultiChildLayoutParentData contentParentData = contentSection.parentData as MultiChildLayoutParentData; contentSection.paint(context, offset + contentParentData.offset); bool hasDivider = contentSection.size.height > 0.0f && actionsSection.size.height > 0.0f; if (hasDivider) { _paintDividerBetweenContentAndActions(context.canvas, offset); } MultiChildLayoutParentData actionsParentData = actionsSection.parentData as MultiChildLayoutParentData; actionsSection.paint(context, offset + actionsParentData.offset); }
protected override bool hitTestChildren(HitTestResult result, Offset position = null) { bool isHit = false; MultiChildLayoutParentData contentSectionParentData = this.contentSection.parentData as MultiChildLayoutParentData; MultiChildLayoutParentData actionsSectionParentData = this.actionsSection.parentData as MultiChildLayoutParentData; ; if (this.contentSection.hitTest(result, position: position - contentSectionParentData.offset)) { isHit = true; } else if (this.actionsSection.hitTest(result, position: position - actionsSectionParentData.offset)) { isHit = true; } return(isHit); }
protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null) { MultiChildLayoutParentData contentSectionParentData = contentSection.parentData as MultiChildLayoutParentData; MultiChildLayoutParentData actionsSectionParentData = actionsSection.parentData as MultiChildLayoutParentData; return(result.addWithPaintOffset( offset: contentSectionParentData.offset, position: position, hitTest: (BoxHitTestResult resultIn, Offset transformed) => { D.assert(transformed == position - contentSectionParentData.offset); return contentSection.hitTest(resultIn, position: transformed); }) || result.addWithPaintOffset( offset: actionsSectionParentData.offset, position: position, hitTest: (BoxHitTestResult resultIn, Offset transformed) => { D.assert(transformed == position - actionsSectionParentData.offset); return actionsSection.hitTest(resultIn, position: transformed); } )); }