🌈 Create new beautiful Compose Gradients with our new wesite ->
Class

PopupProperties

Properties used to customize the behavior of a Popup.

PopupFromServiceSample

@Sampled
@Composable
fun PopupFromServiceSample() {
    // In a real Service scenario, appWindowToken would be received via IPC
    // from the main application process. This sample simulates having the token.
    val appWindowToken: IBinder? = null // Provided via IPC

    var showPopup by remember { mutableStateOf(false) }

    Button(onClick = { showPopup = true }) { Text("Show Popup From Service") }

    if (showPopup) {
        Popup(
            onDismissRequest = { showPopup = false },
            properties =
                PopupProperties(
                    // Pass the application's window token
                    windowToken = appWindowToken
                ),
        ) {
            Box(Modifier.size(200.dp, 100.dp).background(Color.Blue.copy(alpha = 0.8f))) {
                Text("Popup Content (Service)", color = Color.White)
            }
        }
    }
}

PopupWithBlurSample

@Sampled
@Composable
fun PopupWithBlurSample() {
    // Tip: Displaying rich content or an image behind the popup makes the blur effect clearly
    // visible.

    Popup(
        onDismissRequest = {},
        properties = PopupProperties(scrimAlpha = 0.0f, blurBehindRadius = 15.dp),
    ) {
        Box(modifier = Modifier.background(Color.Gray.copy(alpha = 1f)).padding(24.dp)) {
            Text(text = "Popup", modifier = Modifier.padding(24.dp))
        }
    }
}