Is there any best practice for adding two PaddingV...
# compose
t
Is there any best practice for adding two PaddingValues() together?
Currently i am still using custom solution from a previous thread:
Copy code
fun PaddingValues.add(start: Dp = 0.dp, top: Dp = 0.dp, end: Dp = 0.dp, bottom: Dp = 0.dp): PaddingValues {
    return object: PaddingValues {
        override fun calculateLeftPadding(layoutDirection: LayoutDirection) =
            this@add.calculateLeftPadding(layoutDirection) +
                    if (layoutDirection == LayoutDirection.Ltr) start else end
        override fun calculateTopPadding(): Dp =
            this@add.calculateTopPadding() + top
        override fun calculateRightPadding(layoutDirection: LayoutDirection) =
            this@add.calculateRightPadding(layoutDirection) +
                    if (layoutDirection == LayoutDirection.Ltr) end else start
        override fun calculateBottomPadding() =
            this@add.calculateBottomPadding() + bottom
    }
}