https://kotlinlang.org logo
#compose
Title
# compose
t

Tgo1014

11/24/2021, 4:03 PM
Any idea how could I implement something like a
ContentLoadinProgressBar
in compose?
d

Dmitrii Smirnov

11/24/2021, 4:14 PM
looks like box with some logic
if(!showProgress){content()}else{Progress()}
t

Tgo1014

11/24/2021, 4:16 PM
It’s more related to delaying the state of the loading. Basically it wait X before showing and if it show, show for minimum X time. My problem is a bit related to delaying the state change. I’m trying to do with
produceState
not sure if this can work
Apparently this solve my problem, so I’m posting here for people in the future:
Copy code
val _isLoading by produceState(false, isLoading) {
    delay(Duration.milliseconds(500))
    value = if (isLoading != value) {
        isLoading
    } else {
        value
    }
}