Thread
#compose
    Adib Faramarzi

    Adib Faramarzi

    1 year ago
    Is there any way to get the
    size
    of the screen as a value? I thought it would be available in
    LocalDensity.current
    but it isn't.
    Okay, found it. For anyone wondering:
    LocalConfiguration.current.screenHeightDp
    Colton Idle

    Colton Idle

    1 year ago
    From what I've read in this slack before... depending on what you're doing you may want to get the height of the parent container and not the screen height. For example if you're in split screen mode... you probably want to get the value of the parent container. I suspect a lot of times parentContainerHeight == screenHeight, but split screen is a good example of when that's not true.
    Adib Faramarzi

    Adib Faramarzi

    1 year ago
    That is a good point. Are there any references to that height?
    Ashu

    Ashu

    1 year ago
    Adib you can probably use Modifier.onGloballyPositioned.
    Adib Faramarzi

    Adib Faramarzi

    1 year ago
    That is very different from my scenario. I don't want the height of the current composable.
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    1 year ago
    BoxWithConstraints
    is the usual way to do what Colton is talking about. The
    onGloballyPositioned
    modifier is the wrong thing for that in most cases, can cause a frame delay.
    Adib Faramarzi

    Adib Faramarzi

    1 year ago
    Both solutions are not what Colton was talking about. Both these solutions give the size of the
    Latout
    not the window. You need to get the window information anywhere you want.
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    1 year ago
    Colton was talking about getting the size of the container, instead of the window.
    BoxWithConstraints
    is usually the simplest way to do that. It sounds like that’s not what you need but wanted to clarify.