-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInfoModule.kt
More file actions
79 lines (75 loc) · 2.18 KB
/
Copy pathInfoModule.kt
File metadata and controls
79 lines (75 loc) · 2.18 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
75
76
77
78
79
package band.effective.drawer_base
import androidx.compose.foundation.layout.*
import androidx.compose.material.ContentAlpha
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
@Composable
fun InfoModule(
modifier: Modifier = Modifier,
icon: @Composable (() -> Unit)? = null,
title: String,
items: List<Pair<String, String>>,
) {
DebugDrawerModule(
modifier = modifier,
icon = icon,
title = title
) {
Column {
items.forEachIndexed { index, item ->
Column {
DebugModuleInfoContent(item.first, item.second)
if (index < items.size - 1) {
DebugDrawerDivider()
}
}
}
}
}
}
@Composable
fun DebugModuleInfoContent(
key: String,
value: String,
) {
Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
) {
Box(
modifier = Modifier.requiredWidth(80.dp)
) {
CompositionLocalProvider(
LocalContentAlpha provides ContentAlpha.high,
) {
Text(
text = key,
textAlign = TextAlign.Start,
style = MaterialTheme.typography.body2,
)
}
}
Box(
modifier = Modifier
.fillMaxWidth()
.clip(shape = MaterialTheme.shapes.medium)
.padding(8.dp)
) {
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
Text(
text = value,
textAlign = TextAlign.Start,
style = MaterialTheme.typography.body2,
)
}
}
}
}