-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathPanelBottomSheet.kt
More file actions
74 lines (69 loc) · 2.55 KB
/
Copy pathPanelBottomSheet.kt
File metadata and controls
74 lines (69 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.redmadrobot.debug.uikit.components
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.Text
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.redmadrobot.debug.uikit.theme.DebugPanelTheme
import com.redmadrobot.debug.uikit.theme.SystemBarsColors
import com.redmadrobot.debug.uikit.theme.SystemBarsEffect
@OptIn(ExperimentalMaterial3Api::class)
@Composable
public fun PanelBottomSheet(
title: String,
onDismiss: () -> Unit,
modifier: Modifier = Modifier,
content: @Composable ColumnScope.() -> Unit,
) {
val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)
ModalBottomSheet(
onDismissRequest = onDismiss,
sheetState = sheetState,
shape = RoundedCornerShape(topStart = 20.dp, topEnd = 20.dp),
containerColor = DebugPanelTheme.colors.surface.secondary,
modifier = modifier,
dragHandle = { SheetHandle() },
) {
SystemBarsEffect(
systemBarsColors = SystemBarsColors(
statusBarColor = DebugPanelTheme.colors.background.primary,
navigationBarColor = DebugPanelTheme.colors.surface.secondary,
),
)
Column(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 20.dp),
) {
Text(
text = title,
style = DebugPanelTheme.typography.titleLarge,
color = DebugPanelTheme.colors.content.primary,
modifier = Modifier.padding(bottom = 20.dp),
)
content()
}
}
}
@Composable
private fun SheetHandle(modifier: Modifier = Modifier) {
Box(
modifier = modifier
.padding(top = 12.dp, bottom = 20.dp)
.size(width = 32.dp, height = 4.dp)
.background(
color = DebugPanelTheme.colors.stroke.secondary,
shape = RoundedCornerShape(2.dp),
),
)
}