-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSpacers.kt
More file actions
77 lines (68 loc) · 1.93 KB
/
Copy pathSpacers.kt
File metadata and controls
77 lines (68 loc) · 1.93 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
package to.bitkit.ui.components
import androidx.annotation.FloatRange
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.sizeIn
import androidx.compose.foundation.layout.width
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import to.bitkit.ui.theme.Insets
import to.bitkit.ui.theme.TopBarHeight
@Composable
fun VerticalSpacer(height: Dp) {
Spacer(modifier = Modifier.height(height))
}
@Composable
fun ColumnScope.VerticalSpacer(minHeight: Dp, maxHeight: Dp) {
Spacer(
modifier = Modifier
.weight(1f)
.sizeIn(minHeight = minHeight, maxHeight = maxHeight)
)
}
@Composable
fun HorizontalSpacer(width: Dp) {
Spacer(modifier = Modifier.width(width))
}
@Suppress("ComposeMultipleContentEmitters")
@Composable
fun ColumnScope.FillHeight(
@FloatRange weight: Float = 1f,
fill: Boolean = true,
min: Dp = 0.dp,
) {
if (min > 0.dp) Spacer(modifier = Modifier.height(min))
Spacer(modifier = Modifier.weight(weight, fill = fill))
}
@Suppress("ComposeMultipleContentEmitters")
@Composable
fun RowScope.FillWidth(
@FloatRange weight: Float = 1f,
fill: Boolean = true,
min: Dp = 0.dp,
) {
if (min > 0.dp) Spacer(modifier = Modifier.width(min))
Spacer(modifier = Modifier.weight(weight, fill = fill))
}
@Composable
fun StatusBarSpacer(modifier: Modifier = Modifier) {
Spacer(
modifier = modifier.height(Insets.Top)
)
}
@Composable
fun TopBarSpacer(modifier: Modifier = Modifier) {
Spacer(
modifier = modifier.height(TopBarHeight)
)
}
@Composable
fun NavBarSpacer(modifier: Modifier = Modifier) {
Spacer(
modifier = modifier.height(Insets.Bottom)
)
}