2

I'm creating a program in Jetpack Compose Desktop version 1.0.0-beta5 and I can't figure out how to make Column/LazyColumn scrollable. At the same time, it seems to me that a lot of the classes listed in the documentation for Android are missing and can not work from their examples.

val lazyListState = rememberLazyListState()
val scrollState = rememberScrollState()

LazyColumn(
    state = lazyListState,
    modifier = Modifier.verticalScroll(scrollState)
) {
    items(ArrayList<String>()){ item ->
        Column(modifier = Modifier.padding(8.dp)) {
            Text(item)
        }
    }
}

This code is currently producing an error.

To be precise, the empty list used can be seen in the example, but this is just an adjustment, in fact I draw a lot of items.

Honza Rössler
  • 332
  • 3
  • 11
  • I modified this code to show the List, in fact I draw a number of classes over the List. – Honza Rössler Oct 29 '21 at 19:17
  • I removed all the modifiers and remember functions and I was left with this. `LazyColumn { items(ArrayList()){ item -> Column(modifier = Modifier.padding(8.dp)) { Text(item) } } }`. Unfortunately, scrolling doesn't work. – Honza Rössler Oct 29 '21 at 19:33
  • I scrolled through the text and nothing happened. That's why I decided to use a different mouse. It seems to work well with it, so it's probably unsupported hardware. – Honza Rössler Oct 29 '21 at 20:29
  • 1
    You can report it to [official GitHub](https://github.com/JetBrains/compose-jb) including your mouse model and sample project you're using. – Phil Dukhov Oct 29 '21 at 20:32
  • You could try 'ScrollableTabRow' It is not a perfect solution but might work – Linde_98 Nov 02 '21 at 12:22

1 Answers1

0

I know this question is very old, but you can take a look at Desktop Compoments

Jetpack compose is for the android framework, Compose desktop is a flavor of Jetpack compose, it uses Skia and Swing under the hood

Ahmed Hnewa
  • 1,185
  • 1
  • 4
  • 14