forked from microsoft/fluentui-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Divider.kt
42 lines (39 loc) · 1.41 KB
/
Divider.kt
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
package com.microsoft.fluentui.tokenized.divider
import androidx.compose.foundation.background
import androidx.compose.foundation.focusable
import androidx.compose.foundation.layout.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.microsoft.fluentui.theme.FluentTheme
import com.microsoft.fluentui.theme.token.ControlTokens
import com.microsoft.fluentui.theme.token.controlTokens.DividerInfo
import com.microsoft.fluentui.theme.token.controlTokens.DividerTokens
@Composable
fun Divider(
height: Dp = 1.dp,
dividerToken: DividerTokens? = null
) {
val themeID =
FluentTheme.themeID //Adding This only for recomposition in case of Token Updates. Unused otherwise.
val token =
dividerToken
?: FluentTheme.controlTokens.tokens[ControlTokens.ControlType.DividerControlType] as DividerTokens
val dividerInfo = DividerInfo()
Column(
Modifier
.fillMaxWidth()
.background(token.backgroundBrush(dividerInfo))
.focusable(false)
.padding(token.verticalPadding(dividerInfo))
) {
Box(
Modifier
.fillMaxWidth()
.requiredHeight(height)
.background(token.dividerBrush(dividerInfo))
.padding(start = token.startIndent(dividerInfo))
)
}
}