Lilly
09/12/2022, 11:02 PMLazyColumn
? Currently the state is applied to all items. Example code:
@Composable
private fun ScannerList(
items: List<DiscoveredBluetoothDevice>,
connectionState: ConnectionState, // StateFlow in view model
) { ...
private fun ScannerListItem(
connectionState: ConnectionState,
...
) {
ListItem(
trailing = {
Button(onClick = { // trigger change of connectionState in view model })
val iconColor: Color = when (connectionState) { ConnectionState.Connected -> Green600 ... }
}
)
}
Do I have to narrow down List<DiscoveredBluetoothDevice>
so I get sth like List<DiscoveredBluetoothDeviceItem>
?