https://kotlinlang.org logo
a

AmrJyniat

09/09/2022, 10:47 AM
Does
AnimatedVisibility
disable/ignore the padding of its children?
Copy code
AnimatedVisibility(visible = isExpanded) {
    Divider(
       modifier = Modifier.padding(bottom = 12.dp).fillMaxWidth(),
       color = Gray200,
       thickness = 2.dp
    )

    OutlinedButton(
        modifier = Modifier.padding(top = 12.dp),
        onClick = {}
    ){}
}
The padding of both divider and button has no effect when wrapping them within AV, but when I comment AV out the padding works well, am I missing anything?
No, this is what I'm expecting but not happens when wrapping them within AV
l

lesincs

09/12/2022, 1:55 PM
Are you trying to say that the
Modifier.padding(bottom = 12.dp)
for
Divider
is not working? If so I found that both
start
end
top
are working except
bottom
, and if you wrap the
Divider
and
Button
into a
Column
, it will be working as well, so I guess the reason should be the
Layout
inside
AnimatedVisibility
does not care bottom padding.
4 Views