https://kotlinlang.org logo
#compose
Title
# compose
p

Programmistich

06/10/2022, 4:51 PM
Any ideas how to set dim in Popup Compose? In Dialog we have dim alpha from android:backgroundDimAmount, but Popup doesn`t exist
a

andrew

06/10/2022, 5:42 PM
Iirc, you're responsible for drawing your own background
p

Programmistich

06/10/2022, 5:55 PM
But, I can set analog dim-alpha in compose background?
a

andrew

06/10/2022, 5:56 PM
yes, theres a modifier for that, or use a color with an alpha
p

Programmistich

06/11/2022, 7:29 AM
But how i can change status/navigation bar? by rememberSystemUiController ?
a

andrew

06/11/2022, 7:54 PM
Yeah, you can use accompanist for that
p

Programmistich

06/12/2022, 6:06 PM
but interesting facts Popup{ Box(fillMexSize().black() { } } Start and top sides have some spacer 🤔
a

andrew

06/12/2022, 6:07 PM
You need to ignore the window inserts too
That's done at the activity level setting flags on the window or using WindowCompat
p

Programmistich

06/12/2022, 6:08 PM
how?
I mean NOT status bar and navigation I mean red space left screen
a

andrew

06/12/2022, 6:11 PM
Ooohh
Not sure tbh
To be fair, if you want one that's semantically correct, reference Google's material implementation
p

Programmistich

06/12/2022, 6:38 PM
Okey, i really create hack for this
Copy code
var showMenu by remember { mutableStateOf(true) }
val onDismissMenu = { showMenu = false }

 if (showMenu) {
        Dialog(
            onDismissRequest = onDismissMenu,
            properties = DialogProperties(usePlatformDefaultWidth = false)
        ) {
            Box(
                modifier = Modifier
                    .fillMaxSize()
                    .clickable {
                        onDismissMenu.invoke()
                    }
            ) {
// by offset in Modifier u can place content by X and Y 
                Content()
            }
        }
    }
x and y i get from design yeah
4 Views