Thread
#compose
    m

    Matej Drobnič

    1 year ago
    Hello everybody. I have a more technical question regarding the layouting of compose. From documentation, compose has no double measuring. Instead, intrinsics are to be used. However, from what I see in the source code, by default, intrinsics just calls measure: https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/MeasurePolicy.kt;l=138 What is the main difference then? Additionally, isn't that even worse than measuring? For example, if I want both max width and max height of some composable, before I do the final measure, I have to call both intrinsic methods, which will internally call measure twice, instead of just directly calling measure, which would give me both values in one call (but I'm not allowed to do that before final measure). Thanks.
    After some digging, it appears that layouts like Column and Row define their own intrinsics
    does that mean that flow will be significantly slower, since it will have to perform full measure for every intrinsic call?
    Albert Chang

    Albert Chang

    1 year ago
    if I want both max width and max height of some composable
    Intrinsic size is the max/min width/height at a fixed height/width, respectively. Usually you just use one of the four intrinsic sizes. Why do you need both max width and max height?
    since it will have to perform full measure for every intrinsic call
    It's not full measure. Children that override intrinsic size methods (e.g.
    Text
    ) can be measured faster.
    m

    Matej Drobnič

    1 year ago
    I see
    but if one were to implement, let's say, constraint layout, one would need both intrinsics, right?
    to measure for all constraints
    Albert Chang

    Albert Chang

    1 year ago
    ConstraintLayout is the only MultiMeasureLayout. I don't think there's any layout you need to implement yourself using that.
    m

    Matej Drobnič

    1 year ago
    I see
    thanks for your answers