Jetpack Compose TopBar Overflow Menu

Dec 16, 2021
Scaffold(    // scaffoldState = scaffoldState,    topBar = {        TopAppBar(            title = { Text(screenTitle) },            navigationIcon = {                IconButton(onClick = { onBack() }) {                    Icon(                        imageVector = Icons.Filled.ArrowBack,                        contentDescription = "Navigate Up",                        // tint = MaterialTheme.colors.primary                    )                }            },            actions = {                IconButton(onClick = { onSave() }) {                    Icon(                        painterResource(id = R.drawable.ic_baseline_save_24),                        contentDescription = "Save"                    )                }                var showMenu by remember { mutableStateOf(false) }                IconButton(onClick = { showMenu = !showMenu }) {                    Icon(                        imageVector = Icons.Default.MoreVert,                        contentDescription = "More",                    )                }                DropdownMenu(                    expanded = showMenu,                    onDismissRequest = { showMenu = false }                ) {                    DropdownMenuItem(onClick = { onDelete() }) {                        Icon(                            imageVector = Icons.Filled.Delete,                            contentDescription = "Delete",                        )                        Text("Delete")                    }                }            }        )    }) { innerPadding ->    // content}

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.