How can I have a dialog with 95% of the width of t...
# compose
p
How can I have a dialog with 95% of the width of the landscape screen in compose? setting
modifier.fillmaxwidth(0.95f)
doesnt work. It seems that Dialog class has a forced maximum width. I tryed disabling it, using
usePlatformDefaultWidth = false
but then it ignores the width of their childrens and it has more width than the screen itself.
a
you can't (i hope someone here can prove me wrong). this is why http://composeunstyled.com/dialog exists so you can size and style your dialogs exactly as you want
p
you mean is not possible to do it with the default dialog classes given by compose? and that we are forced to import third party libraries to do it?
I hope that is not correct
a
> you mean is not possible to do it with the default dialog classes given by compose? yes. dialogs on android (which i am assuming you are on) have a fixed max width, last time i used it which was a while. you are not forced to use a 3rd party library and you can override this but it is a bit involved. requires to create a fully transparent dialog which takes the full screen size via xml themes
p
in Android, how to get available height? without the unusable parts (top camera part and botom buttons if they are present)
m
If you need a value you could get systemBars insets from WindowInsets and subtract from screen height. More here: https://developer.android.com/develop/ui/compose/layouts/insets
1
p
so there is not an automatically generated value that returns the total available height substracting automatically bars, top header etc... if present?
that is a must
a
never really had a need for that. what are u trying to achieve?
p
I disscovered a way to use the normal dialog with a custom width and height, but I need to know the exact available space substrating the size occupied by the OS components