Leland Richardson [G]
05/25/2020, 2:29 PMKazemihabib1996
05/26/2020, 2:40 PMmodifiers
based on those parameters.
But every time I want to use these parameters I have to check the source code to know the order of the applied modifiers.
So why should we bother ourselves when we can easily do the same with modifiers with full control over the order of modifiers
.
@Composable
fun PaddingModifier() {
Stack(Modifier.drawBackground(Color.Gray)) {
Box(
Modifier
.padding(start = 20.dp, top = 30.dp, end = 20.dp, bottom = 30.dp)
.preferredSize(200.dp)
.drawBorder(Border(10.dp, Color.Green))
.drawBackground(Color.Blue)
)
}
}
@Composable
fun PaddingModifier3() {
Stack(Modifier.drawBackground(Color.Gray)) {
Box(
Modifier
.padding(start = 20.dp, top = 30.dp, end = 20.dp, bottom = 30.dp)
.preferredSize(200.dp)
.drawBackground(Color.Blue)
)
}
}
@Composable
fun PaddingModifier4() {
Stack(Modifier.drawBackground(Color.Gray)) {
Box(
Modifier
.drawBorder(Border(10.dp, Color.Green))
.padding(start = 20.dp, top = 30.dp, end = 20.dp, bottom = 30.dp)
.preferredSize(200.dp)
.drawBackground(Color.Blue)
)
}
}
IMHO those parameters are just making it more complex because we have to check the source code. Specially it makes harder for teaching.
When I said these padding parameters implies that the Box is different from other layout composables.
I mean, it makes harder for new users.Leland Richardson [G]
05/26/2020, 4:28 PM