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

Subhash

01/29/2020, 4:27 PM
Copy code
Minor help request: I am not being able to scroll the contents. Am I doing something wrong here?@Composable
fun ArtistsList(artistsLiveData: LiveData<List<Artist>>) {
    val artists = +state { artistsLiveData.value }
    val artistObserver = Observer<List<Artist>> {
        artists.value = it
    }
    +onActive {
        artistsLiveData.observeForever(artistObserver)
    }
    +onDispose {
        artistsLiveData.removeObserver(artistObserver)
    }
    VerticalScroller {
        Column(modifier = Expanded) {
            artists.value?.forEach {
                Row(modifier = ExpandedWidth wraps Spacing(all = 8.dp)) {
                    Container(Spacing(4.dp), width = 40.dp, height = 40.dp) {
                        val image = +state<Image?> { null }
                        prepareImage(url = it.picture_small, state = image)
                        image.value?.let {
                            DrawImage(image = it)
                        }
                    }
                    Text(
                        text = it.name,
                        modifier = ExpandedWidth,
                        style = (+ambient(Typography)).body1
                    )
                }
            }
        }
    }
}
z

Zsolt

01/29/2020, 4:37 PM
Can it be that your expanded Column is limiting all the elements inside, but because it's the single element in your VerticalScroller, the latter believes there's nothing to scroll?
not sure, just shooting blindly at it
s

Subhash

01/31/2020, 1:39 AM
Thanks!!, the scrolling of list worked after update to beta 4.
3 Views