Skip to content

Commit

Permalink
Merge pull request #93 from grodnoroads/1.2.9
Browse files Browse the repository at this point in the history
Rework logic with insets
  • Loading branch information
egorikftp authored Apr 23, 2024
2 parents b50bd89 + 757f376 commit e31a195
Showing 1 changed file with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ private fun VerticalOrientationLayout(
label = "bottomPadding"
)

val contentPaddingValues = WindowInsets
.systemBars
.add(WindowInsets(bottom = bottomPadding))
.asPaddingValues()

Box(modifier = Modifier.fillMaxSize()) {
Children(
modifier = Modifier.fillMaxSize(),
Expand All @@ -85,14 +80,20 @@ private fun VerticalOrientationLayout(
when (val child = created.instance) {
is Child.Map -> {
MapScreen(
contentPadding = contentPaddingValues,
contentPadding = WindowInsets
.systemBars
.add(WindowInsets(bottom = bottomPadding))
.asPaddingValues(),
component = child.component,
onBottomNavigationVisibilityChange = { isShowBottomBar = it }
)
}

is Child.Settings -> SettingsScreen(
contentPadding = PaddingValues(0.dp),
contentPadding = WindowInsets
.navigationBars
.add(WindowInsets(bottom = bottomPadding))
.asPaddingValues(),
settingsComponent = child.component
)
}
Expand Down Expand Up @@ -136,9 +137,6 @@ private fun HorizontalOrientationLayout(
targetValue = if (isHideBottomBar) NavigationBarHeight else 0.dp,
label = "leftPadding"
)
val contentPaddingValues = WindowInsets.systemBars
.add(WindowInsets(left = leftPadding))
.asPaddingValues()

Box(modifier = Modifier.fillMaxSize()) {
Children(
Expand All @@ -147,13 +145,17 @@ private fun HorizontalOrientationLayout(
) { created ->
when (val child = created.instance) {
is Child.Map -> MapScreen(
contentPadding = contentPaddingValues,
contentPadding = WindowInsets.systemBars
.add(WindowInsets(left = leftPadding))
.asPaddingValues(),
component = child.component,
onBottomNavigationVisibilityChange = { isHideBottomBar = it }
)

is Child.Settings -> SettingsScreen(
contentPadding = PaddingValues(start = leftPadding),
contentPadding = WindowInsets.navigationBars
.add(WindowInsets(left = leftPadding))
.asPaddingValues(),
settingsComponent = child.component
)
}
Expand Down

0 comments on commit e31a195

Please sign in to comment.