Philip Blandford
11/13/2021, 12:00 PM@Composable
fun PopupTest() {
val show = remember{ mutableStateOf(false)}
val ctr = remember{ mutableStateOf(0)}
Box(
Modifier
.fillMaxSize()
.clickable { ctr.value += 1 }) {
Button({show.value = !show.value}, Modifier.align(Alignment.TopCenter).offset(y = 20.dp)) {
Text("Show Popup")
}
if (show.value) {
Popup(alignment = Alignment.Center,
onDismissRequest = {show.value = false}){
Text("I am the popup", Modifier.border(1.dp, Color.Black))
}
}
Text("Ctr ${ctr.value}",
Modifier
.align(Alignment.BottomCenter)
.offset(y = -20.dp))
}
}
okarm
11/13/2021, 1:19 PMPopup
composable is broken atm. Use DropDown
DropdownMenu
instead.
Don't be confused by the name DropDown
DropdownMenu
, it produces a Popup
.Louis Pullen-Freilich [G]
11/13/2021, 2:16 PM