Is there a way to prevent the parent composables p...
# compose
a
Is there a way to prevent the parent composables padding to clip the shadow of the child-composables?
e.g. to prevent this:
f
I think that all top-level scroll componets clip children. In this example I would remove the padding of parent and set it on children
a
So every child needs to set the padding separately? This seems to be really un-DRY though?
Oh wow, I just found out that it's all about the ordering of the modifier
This clips:
Copy code
Modifier
.padding(horizontal = 24.dp)
.verticalScroll(rememberScrollState())
This does not clip:
Copy code
Modifier
.verticalScroll(rememberScrollState())
.padding(horizontal = 24.dp)
Interesting (TM)
f
Oh! You are not using "top-level scroll componet" then 😄 Yeah, this makes sense...
a
I am using a
Column
and enable the scroll and padding on that component via the modifier.. is this the wrong way to go about things? 😄
f
If there will more than those few children like on the pic than yes. You should use
LazyColumn
a
Yeah this is what I gathered from the available info. From my understanding it's the same as
RecyclerView
vs
ScrollView
right?
ScrollView
has its uses too, so if the lists are short and not too dynamic I would use a
Column
with
scrollModifier
. Is this the right way to do it though?
f
Exactly. But I personally would just use
LazyColumn
for everything scrollable since it's not that much harder. But for small lists you can certainly use
Column
with scroll modifier if that's what you prefer.