private void determineMainSize(@FlexDirection int flexDirection, int widthMeasureSpec,
            int heightMeasureSpec) {
        int mainSize;
        int paddingAlongMainAxis;
        switch (flexDirection) {
            case FLEX_DIRECTION_ROW: // Intentional fall through
            case FLEX_DIRECTION_ROW_REVERSE:
                int widthMode = MeasureSpec.getMode(widthMeasureSpec);
                int widthSize = MeasureSpec.getSize(widthMeasureSpec);
                if (widthMode == MeasureSpec.EXACTLY) {
                    mainSize = widthSize;
                } else {
                    mainSize = getLargestMainSize();
                }
                paddingAlongMainAxis = getPaddingLeft() + getPaddingRight();
                break;
            case FLEX_DIRECTION_COLUMN: // Intentional fall through
            case FLEX_DIRECTION_COLUMN_REVERSE:
                int heightMode = MeasureSpec.getMode(heightMeasureSpec);
                int heightSize = MeasureSpec.getSize(heightMeasureSpec);
                if (heightMode == MeasureSpec.EXACTLY) {
                    mainSize = heightSize;
                } else {
                    mainSize = getLargestMainSize();
                }
                paddingAlongMainAxis = getPaddingTop() + getPaddingBottom();
                break;
            default:
                throw new IllegalArgumentException("Invalid flex direction: " + flexDirection);
        }

        int childIndex = 0;
        for (FlexLine flexLine : mFlexLines) {
            if (flexLine.mMainSize < mainSize) {
                childIndex = expandFlexItems(widthMeasureSpec, heightMeasureSpec, flexLine,
                        flexDirection, mainSize, paddingAlongMainAxis, childIndex, false);
            } else {
                childIndex = shrinkFlexItems(widthMeasureSpec, heightMeasureSpec, flexLine,
                        flexDirection, mainSize, paddingAlongMainAxis, childIndex, false);
            }
        }
    }
Determine the main size by expanding (shrinking if negative remaining free space is given)
an individual child in each flex line if any children's flexGrow (or flexShrink if remaining
space is negative) properties are set to non-zero.

@param flexDirection     the value of the flex direction
@param widthMeasureSpec  horizontal space requirements as imposed by the parent
@param heightMeasureSpec vertical space requirements as imposed by the parent
@see #setFlexDirection(int)
@see #getFlexDirection()
common/src/main/java/com/sxjs/common/widget/flexboxlayout/FlexboxLayout.java