@@ -4,7 +4,9 @@ import android.content.res.Configuration
4
4
import android.graphics.Color
5
5
import androidx.compose.foundation.background
6
6
import androidx.compose.foundation.isSystemInDarkTheme
7
+ import androidx.compose.foundation.layout.Box
7
8
import androidx.compose.foundation.layout.Column
9
+ import androidx.compose.foundation.layout.PaddingValues
8
10
import androidx.compose.foundation.layout.WindowInsets
9
11
import androidx.compose.foundation.layout.WindowInsetsSides
10
12
import androidx.compose.foundation.layout.asPaddingValues
@@ -13,6 +15,7 @@ import androidx.compose.foundation.layout.imePadding
13
15
import androidx.compose.foundation.layout.navigationBars
14
16
import androidx.compose.foundation.layout.only
15
17
import androidx.compose.foundation.layout.padding
18
+ import androidx.compose.foundation.layout.statusBars
16
19
import androidx.compose.foundation.layout.widthIn
17
20
import androidx.compose.foundation.shape.RoundedCornerShape
18
21
import androidx.compose.material3.MaterialTheme
@@ -261,36 +264,49 @@ private fun GravatarModalBottomSheet(
261
264
Scrim (
262
265
scrimColor = MaterialTheme .colorScheme.scrim.copy(alpha = 0.32f ),
263
266
)
264
- Sheet (
267
+ Box (
265
268
modifier = Modifier
266
- .imePadding()
267
- .clip(RoundedCornerShape (topStart = 28 .dp, topEnd = 28 .dp))
268
- .background(MaterialTheme .colorScheme.surfaceColorAtElevation(1 .dp))
269
- .widthIn(max = 640 .dp)
270
- .fillMaxWidth()
271
269
.padding(
272
- WindowInsets .navigationBars
273
- .only(WindowInsetsSides .Vertical )
274
- .asPaddingValues(),
270
+ paddingValues = if (configuration.orientation == Configuration .ORIENTATION_LANDSCAPE ) {
271
+ PaddingValues (0 .dp)
272
+ } else {
273
+ WindowInsets .statusBars
274
+ .only(WindowInsetsSides .Top )
275
+ .asPaddingValues()
276
+ },
275
277
),
276
278
) {
277
- val window = LocalModalWindow .current
278
- val isDarkTheme = isSystemInDarkTheme()
279
- LaunchedEffect (Unit ) {
280
- window.navigationBarColor = Color .TRANSPARENT
281
- WindowInsetsControllerCompat (window, window.decorView).isAppearanceLightNavigationBars =
282
- ! isDarkTheme
283
- }
284
- Surface (
279
+ Sheet (
285
280
modifier = Modifier
286
- .fillMaxWidth(),
287
- tonalElevation = 1 .dp,
281
+ .imePadding()
282
+ .clip(RoundedCornerShape (topStart = 28 .dp, topEnd = 28 .dp))
283
+ .background(MaterialTheme .colorScheme.surfaceColorAtElevation(1 .dp))
284
+ .widthIn(max = 640 .dp)
285
+ .fillMaxWidth()
286
+ .padding(
287
+ WindowInsets .navigationBars
288
+ .only(WindowInsetsSides .Vertical )
289
+ .asPaddingValues(),
290
+ ),
288
291
) {
289
- Column (
290
- horizontalAlignment = Alignment .CenterHorizontally ,
292
+ val window = LocalModalWindow .current
293
+ val isDarkTheme = isSystemInDarkTheme()
294
+ LaunchedEffect (Unit ) {
295
+ window.navigationBarColor = Color .TRANSPARENT
296
+ WindowInsetsControllerCompat (window, window.decorView).isAppearanceLightNavigationBars =
297
+ ! isDarkTheme
298
+ }
299
+ Surface (
300
+ modifier = Modifier
301
+ .fillMaxWidth(),
302
+ tonalElevation = 1 .dp,
291
303
) {
292
- QEDragHandle ()
293
- content()
304
+ Column (
305
+ horizontalAlignment = Alignment .CenterHorizontally ,
306
+ ) {
307
+ QEDragHandle ()
308
+ content()
309
+ }
294
310
}
295
311
}
296
312
}
@@ -300,12 +316,11 @@ private fun GravatarModalBottomSheet(
300
316
}
301
317
}
302
318
303
- internal val peek = SheetDetent (identifier = " peek" ) { containerHeight, _ ->
304
- containerHeight * 0.6f
305
- }
306
-
307
319
@Composable
308
320
internal fun AvatarPickerContentLayout.modalDetents (): ModalDetents {
321
+ val peek = SheetDetent (identifier = " peek" ) { containerHeight, sheetHeight ->
322
+ containerHeight * 0.6f
323
+ }
309
324
val windowHeightSizeClass = currentWindowAdaptiveInfo().windowSizeClass.windowHeightSizeClass
310
325
val initialDetent = if (windowHeightSizeClass == WindowHeightSizeClass .COMPACT ) {
311
326
FullyExpanded
0 commit comments