Skip to content

Commit

Permalink
Include displayCutout() in Modal demos
Browse files Browse the repository at this point in the history
  • Loading branch information
alexstyl committed Oct 11, 2024
1 parent 5b0a36c commit e8224f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 30 deletions.
13 changes: 4 additions & 9 deletions demo-dialog/src/commonMain/kotlin/DialogDemo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@ import androidx.compose.animation.scaleOut
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicText
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -64,7 +57,9 @@ fun DialogDemo() {
}
Dialog(state = dialogState) {
DialogPanel(
modifier = Modifier.systemBarsPadding()
modifier = Modifier
.displayCutoutPadding()
.systemBarsPadding()
.widthIn(min = 280.dp, max = 560.dp)
.padding(20.dp)
.clip(ComposeTheme.shapes.roundXL)
Expand Down
24 changes: 3 additions & 21 deletions demo-modalsheet/src/commonMain/kotlin/ModalBottomSheetDemo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,7 @@ import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicText
import androidx.compose.runtime.Composable
Expand All @@ -32,14 +18,9 @@ import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import com.composables.core.DragIndication
import com.composables.core.ModalBottomSheet
import com.composables.core.Scrim
import com.composables.core.Sheet
import com.composables.core.SheetDetent
import com.composables.core.*
import com.composables.core.SheetDetent.Companion.FullyExpanded
import com.composables.core.SheetDetent.Companion.Hidden
import com.composables.core.rememberModalBottomSheetState

private val Peek = SheetDetent("peek") { containerHeight, sheetHeight ->
containerHeight * 0.6f
Expand Down Expand Up @@ -78,6 +59,7 @@ fun ModalBottomSheetDemo() {
modifier = Modifier
.padding(top = 12.dp)
.let { if (isCompact) it else it.padding(horizontal = 56.dp) }
.displayCutoutPadding()
.statusBarsPadding()
.padding(WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal).asPaddingValues())
.shadow(4.dp, RoundedCornerShape(topStart = 28.dp, topEnd = 28.dp))
Expand Down

0 comments on commit e8224f1

Please sign in to comment.