Skip to content

Commit

Permalink
fix(ui): ModalBottomSheet insets workaround for SDK_INT < 30
Browse files Browse the repository at this point in the history
  • Loading branch information
JunkFood02 committed Apr 3, 2024
1 parent f6c552f commit e335229
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package com.junkfood.seal.ui.component

import android.os.Build
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
Expand Down Expand Up @@ -45,12 +48,33 @@ fun SealModalBottomSheet(
content()
Spacer(modifier = Modifier.height(28.dp))
}
NavigationBarSpacer(
Spacer(
modifier = Modifier
.background(MaterialTheme.colorScheme.surfaceContainerHigh)
.fillMaxWidth()
)
.height(
with(
WindowInsets.navigationBars
.asPaddingValues()
.calculateBottomPadding()
) {
when {
this.value > 30f -> {
this
}

// FIXME: https://issuetracker.google.com/issues/290798798
Build.VERSION.SDK_INT < 30 -> {
48.dp
}

else -> {
0.dp
}
}
}
)
)
}
}

Expand Down

0 comments on commit e335229

Please sign in to comment.