Is there any way within compose to mimic the “divi...
# compose
m
Is there any way within compose to mimic the “divider” behavior of LinearLayout? Obviously I could manually place a Divider between elements, but i’m looking for a more automated behavior so that the dividers would be automatically placed, something like: DividedColumn( divider = { Divider() }, showDividers = ShowDividers.All ) { …. }
🤔 1
j
Feels like some options: • Custom Column, like modify from source. • Add DSL into ColumnScope like LazyColumn which automatic add divider between items looped. • Custom Arrangement. Not sure if arrangement supports compose code or only pixel arrangements. This would be ideal, as could reuse everywhere in Row, Lazy lists etc as well. • Ask Google add decorator pattern or such similar as we had in RecyclerView or LinearLayout as mentioned. • Another semi hacky solution, custom layout wrapping Column. Send in list and add divider between each. • Make custom item compose object hide/show divider top or bottom I understand what youre after and also wish existed one built in. But a lot easier in compose :)
m
Just make a modifier extension that uses drawBehind :p
m
@myanmarking Except you can't get access to the items to know where to draw, at least that i've been able to figure out.