Skip to content

Commit af9805a

Browse files
add default before and after labels
1 parent e363391 commit af9805a

File tree

1 file changed

+26
-0
lines changed
  • image/src/main/java/com/smarttoolfactory/image/beforeafter

1 file changed

+26
-0
lines changed

image/src/main/java/com/smarttoolfactory/image/beforeafter/Label.kt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package com.smarttoolfactory.image.beforeafter
22

33
import androidx.compose.foundation.background
4+
import androidx.compose.foundation.layout.BoxScope
45
import androidx.compose.foundation.layout.padding
56
import androidx.compose.foundation.shape.RoundedCornerShape
67
import androidx.compose.material.Text
78
import androidx.compose.runtime.Composable
9+
import androidx.compose.ui.Alignment
810
import androidx.compose.ui.Modifier
911
import androidx.compose.ui.graphics.Color
1012
import androidx.compose.ui.text.font.FontWeight
@@ -26,3 +28,27 @@ fun Label(modifier: Modifier = Modifier, text: String) {
2628
.padding(horizontal = 12.dp, vertical = 8.dp)
2729
)
2830
}
31+
32+
@Composable
33+
fun BoxScope.BeforeLabel(contentOrder: ContentOrder) {
34+
Label(
35+
text = "Before", modifier = Modifier
36+
.padding(8.dp)
37+
.align(
38+
if (contentOrder == ContentOrder.BeforeAfter)
39+
Alignment.TopStart else Alignment.TopEnd
40+
)
41+
)
42+
}
43+
44+
@Composable
45+
fun BoxScope.AfterLabel(contentOrder: ContentOrder) {
46+
Label(
47+
text = "After", modifier = Modifier
48+
.padding(8.dp)
49+
.align(
50+
if (contentOrder == ContentOrder.BeforeAfter)
51+
Alignment.TopEnd else Alignment.TopStart
52+
)
53+
)
54+
}

0 commit comments

Comments
 (0)