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);
        }
Exemple #2
0
        protected override void performLayout()
        {
            BoxConstraints constraints = this.constraints;

            _resolve();
            D.assert(_resolvedPadding != null);
            if (child == null)
            {
                size = constraints.constrain(new Size(
                                                 _resolvedPadding.left + _resolvedPadding.right,
                                                 _resolvedPadding.top + _resolvedPadding.bottom
                                                 ));
                return;
            }
            BoxConstraints innerConstraints = constraints.deflate(_resolvedPadding);

            child.layout(innerConstraints, parentUsesSize: true);
            BoxParentData childParentData = child.parentData as BoxParentData;

            childParentData.offset = new Offset(_resolvedPadding.left, _resolvedPadding.top);
            size = constraints.constrain(new Size(
                                             _resolvedPadding.left + child.size.width + _resolvedPadding.right,
                                             _resolvedPadding.top + child.size.height + _resolvedPadding.bottom
                                             ));
        }
Exemple #3
0
        protected override void performLayout()
        {
            BoxConstraints constraints = this.constraints;

            size = constraints.biggest;

            if (child == null)
            {
                return;
            }
            BoxConstraints enforcedConstraint = constraints
                                                .deflate(EdgeInsets.symmetric(horizontal: CupertinoTextSelectionUtils._kToolbarScreenPadding))
                                                .loosen();

            child.layout(heightConstraint.enforce(enforcedConstraint), parentUsesSize: true);
            _ToolbarParentData childParentData = child.parentData as _ToolbarParentData;


            float lowerBound      = child.size.width / 2 + CupertinoTextSelectionUtils._kToolbarScreenPadding;
            float upperBound      = size.width - child.size.width / 2 - CupertinoTextSelectionUtils._kToolbarScreenPadding;
            float adjustedCenterX = _arrowTipX.clamp(lowerBound, upperBound);

            childParentData.offset = new Offset(adjustedCenterX - child.size.width / 2, _barTopY);
            childParentData.arrowXOffsetFromCenter = _arrowTipX - adjustedCenterX;
        }