Useful Modifiers In Jetpack Compose Part — I
2 min readOct 8, 2023
In this article we will see some useful modifiers in jetpack , that you must aware about it.
1). border Modifier
@Composable
fun MakeBorder(
modifier: Modifier = Modifier
) {
Box(modifier = modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Spacer(
modifier = Modifier
.border(
color = Color.Red,
width = 2.dp,
shape = CircleShape
)
.size(100.dp)
)
}
}
2). horizontalScroll Modifier
@Composable
fun HorizontalScroll(
modifier: Modifier = Modifier
) {
val scrollState = rememberScrollState()
Row(
modifier = modifier
.padding(20.dp)
.horizontalScroll(scrollState)
.fillMaxSize(),
verticalAlignment = Alignment.CenterVertically
) {
repeat(10) {
Text(
text = "Text $it",
style = TextStyle(
fontSize = 20.sp,
fontWeight = FontWeight.W600
),
modifier =…