Preserve behaviour pre-fix(i.e if a user opened the drawer and landscaped by choice).

This commit is contained in:
KotlinGeekDev
2023-08-11 23:32:27 +01:00
parent 6875fdc4d0
commit d921eb6138

View File

@@ -77,8 +77,9 @@ fun MainScreen(
val navState = navController.currentBackStackEntryAsState()
val orientation = LocalConfiguration.current.orientation
val currentDrawerState = scaffoldState.drawerState.currentValue
LaunchedEffect(key1 = orientation) {
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
if (orientation == Configuration.ORIENTATION_LANDSCAPE && currentDrawerState == DrawerValue.Closed) {
scaffoldState.drawerState.close()
}
}