How to detect when spinner opened in compose

129 views Asked by At

I want to detect when my dropdown menu clicked or opened in jetpack compose and perform an operation on that click.

This is the code that I'm Currently using.

Spinner(
    modifier = modifier
        .fillMaxWidth()
        .heightIn(min = 40.dp)
        .border(1.dp, alto)
        .background(if (enabled) white else gray.copy(alpha = 0.7f))
        .onGloballyPositioned { layoutCoordinates ->
            rowSize = layoutCoordinates.size.toSize()
        },
    dropDownModifier = dropdownModifier
        .width(with(LocalDensity.current) { rowSize.width.toDp() })
        .wrapContentHeight(),
    enabled = enabled,
    items = displayItems,
    selectedItem = selected,
    onItemSelected = onSelectionChange,
    selectedItemFactory = selectedItemFactory,
    dropdownItemFactory = dropdownItemFactory,
)

0

There are 0 answers