ListView

@Composable
fun <M : SelectionModel<ListIndexModel.ListIndex>> ListView(items: Int, selectionMode: SelectionMode<M>, modifier: Modifier = Modifier, enableRubberband: Boolean = false, singleClickActivate: Boolean = false, showSeparators: Boolean = false, tabBehaviour: ListTabBehavior = ListTabBehavior.ALL, onActivate: (position: Int) -> Unit? = null, child: @Composable (index: Int) -> Unit): M

Creates a org.gnome.gtk.ListView with items items. Each element is a composable created using child.

The created org.gnome.gio.ListModel will have the specified selectionMode (e.g. SelectionMode.Multiple).

Example:

ListView(
items = 10000,
selectionMode = SelectionMode.Multiple,
) { index ->
Label("Item #$index")
}

You usually want to wrap this component into a scrollable container, like ScrolledWindow.

You can use ListView(model){ ... } if you want more customization options.

Return

the selection model you can use to manage the selection


@Composable
fun <T : GObject> ListView(model: SelectionModel<T>, modifier: Modifier = Modifier, enableRubberband: Boolean = false, singleClickActivate: Boolean = false, showSeparators: Boolean = false, tabBehaviour: ListTabBehavior = ListTabBehavior.ALL, onActivate: (position: Int) -> Unit? = null, child: @Composable (item: T) -> Unit)

Creates a org.gnome.gtk.ListView bound to the given model. Each element is a composable created using child.

SelectionModel can be created using the rememberNoSelectionModel, rememberSingleSelectionModel and rememberMultiSelectionModel functions, but you can also create them explicitly if you need more customization.