0

in this app I have the following custom composable item

@Composable
fun PriorityItem(priority: Priority) {
    Row(verticalAlignment = Alignment.CenterVertically) {
        Canvas(modifier = Modifier.size(PRIORITY_INDICATOR_SIZE)) {
            drawCircle(color = priority.color)
        }
        Text(
            modifier = Modifier.padding(start = LARGE_PADDING), text = priority.name,
            style = Typography.headlineMedium,
            color = MaterialTheme.colorScheme.onSurface
        )
    }
}

I am trying to add it inside DropDownMenu repeated 3 times as three drop-down menu items, but in this version, the DropDownMenuItem doesn't have a row scope to which I can add my custom item PriorityItem


@Composable
fun SortAction(onSortClicked: (Priority) -> Unit) {

    var expanded by remember() {
        mutableStateOf(false)
    }

    IconButton(onClick = {expanded = true}) {
        Icon(
            painter = painterResource(id = R.drawable.baseline_filter_list_24),
            contentDescription = stringResource(R.string.sort_tasks)
        )

        DropdownMenu(expanded = expanded, onDismissRequest = { expanded = false}) {
            DropdownMenuItem(text = { /*TODO*/ },
                onClick = { /*TODO*/ }){
                
            }
        }
    }
}

the following image is exactly what I want to do but the tutorial is old

enter image description here

Dr Mido
  • 2,414
  • 4
  • 32
  • 72

0 Answers0