I am currently working on an Android App written in Kotlin with Jetpack Compose. My goal is to get a responsive app that runs on smartphones and tables responsively. To do this I get the user's curent width and then decide on that width how I will display the UI because in some cases I have to show something else.
I get the current width of the user's display by using a BoxWithConstraints:
BoxWithConstraints(modifier = Modifier.fillMaxSize())
{
val largeScreen = this.maxWidth > 1000.dp
}
This works fine for now but when a user is rotating the screen on his smartphone to landscape I get problems because of the miniscule height of the device. In my app it does not even make sense to use it in landscape. And I do not want users to use landscape in the app on smartphones. It is fine on tablet devices but not on smartphones.
All I could find was to lock portrait mode for the whole app. But what I would love to have would be to enable landscape and portrait on tablet and enable portrait mode solely on smartphone.
Has anyone also had this problem.
Thanks a lot!