Hi guys, in compose is there anyway that we could ...
# compose
s
Hi guys, in compose is there anyway that we could detect content from the child is bigger than its parent? I used onSizeChanged for the child but it max height is same as the parent only
Copy code
Box(
    modifier = Modifier.onSizeChanged {
        val height = destiny.run { limit.toPx().toDp() }
        isLarger = limit < height
    },
)
a
what are you trying to achieve? (as in why do you need this)
s
I want to achieve something like this
a
how does your question relate to what you are trying to achieve? im confused abt which part of your design you are struggling with
s
If the content is bigger than its parent, show the blur and 3 dots, otherwise, just show the child and it's parent based on the child height
z
You could make a layout that composes the three dots and then measures the text element and only places the dots if the text element is too big (and decide whether to draw the gradient) You can use TextMeasurer or onTextLayoutResult to check if text will overflow if you want specific information about how much text will be cut off.
👍 1
s
@Zach Klippenstein (he/him) [MOD] I haven't try this, but look like your solution is only works for Text, right? I expect to work with all kind of childs
z
No it will work for anything. Just not the text measuring part, but I only mentioned those in case you cared where the text was truncated.