its probably been asked before, but is there a good example of implementing an element in view modifier? i.e. I want to know when a composable in say a lazycolumn becomes visible to the user on screen?
o
Oliver.O
02/08/2023, 7:16 PM
Would this suffice?
Copy code
class DrawLoggingModifier(private val subject: String) : DrawModifier {
override fun ContentDrawScope.draw() {
<http://logger.info|logger.info> { "Drawing $subject" }
drawContent()
}
}
fun Modifier.logDrawing(subject: String) = this.then(DrawLoggingModifier(subject))
a
agrosner
02/09/2023, 1:01 AM
I don’t think so because lazy layouts pre load the content off screen. I need to know when it’s sufficiently visible on screen
o
Oliver.O
02/09/2023, 1:13 AM
In my recent tests using Compose Desktop the above modifier was logging visible elements only.