https://kotlinlang.org logo
#compose
Title
# compose
d

dimsuz

04/07/2022, 2:25 PM
While writing a custom layout I just discovered that having some
alignment
value I can do
Copy code
// alignment = Alignment.Center
val x = alignment.align(myWidth, parentWidth, LayoutDirection.Rtl)
It's a (seemingly) small thing but very nice to not having repeat those boring
width/2 - myWidth/2
etc!
👍 2
s

Stylianos Gakis

04/09/2022, 10:42 AM
the
.align
function seems to receive
(IntSize, IntSize, LayoutDirection)
so I guess either I’m missing some import of you didn’t actually pass
myWidth
and
parentWidth
in the first two parameters?
d

dimsuz

04/12/2022, 4:50 PM
this depends on alignment, if it has one axis, such as Horizontal or Vertical, then there will be "Int"s there...
2 Views