Saturday 29 April 2023

Displaying a dropdownmenu at the top end of the composable screen

I have the following where I want to display the dropdownmenu on the left and I want to display on the right.

enter image description here

I have the following code, that uses a Scaffold and in that I have a topBar with a column which I have my AgendaTopBar and the AgendaDropDownMenu below that which is align(Alignment.End)

 Scaffold(
        modifier = modifier,
        topBar = {
            Column(modifier = Modifier.fillMaxWidth()) {
                AgendaTopBar(
                    modifier = Modifier
                        .fillMaxWidth()
                        .background(color = MaterialTheme.colorScheme.backgroundBackColor)
                        .padding(start = 16.dp, end = 16.dp, top = 8.dp, bottom = 8.dp),
                    initials = agendaScreenState.usersInitials,
                    displayMonth = agendaScreenState.selectedDate.month.toString(),
                    onProfileButtonClicked = {
                        agendaScreenEvent(AgendaScreenEvent.OnOpenLogoutDropDownMenu(shouldOpen = true))
                    },
                    onDateClicked = {
                        calendarState.show()
                    },
                )

                AgendaDropDownMenu(
                    modifier = Modifier
                        .background(color = MaterialTheme.colorScheme.dropDownMenuBackgroundColor)
                        .align(Alignment.End),
                    shouldOpenDropdown = agendaScreenState.shouldOpenLogoutDropDownMenu,
                    onCloseDropdown = {
                        agendaScreenEvent(
                            AgendaScreenEvent.OnChangedShowDropdownStatus(shouldOpen = false)
                        )
                    },
                    listOfMenuItemId = listOf(me.androidbox.presentation.R.string.logout),
                    onSelectedOption = { _ ->
                        agendaScreenEvent(AgendaScreenEvent.OnOpenLogoutDropDownMenu(shouldOpen = false))
                        onLogout()
                    }
                )
            }
        },
        floatingActionButton = { 


from Displaying a dropdownmenu at the top end of the composable screen

No comments:

Post a Comment