Zsolt

    Zsolt

    2 years ago
    Padding with negative values used to work before, now it crashes runtime (no compilation warnings given):
    LayoutPadding(bottom = (-10).dp, end = (-5).dp)
    Beyond the crash, what's the suggested way to achieve the same positioning?
    java.lang.IllegalArgumentException: Padding must be non-negative
    l

    Leland Richardson [G]

    2 years ago
    @Mihai Popa what’s our recommendation here? depends on the use case??? @Zsolt what is it you’re trying to do? Are you trying to “undo” another padding, or are you trying to actually do like a negative offset? I think we have an Offset modifier now which will allow negative values
    Zsolt

    Zsolt

    2 years ago
    No undoing, just positioning background decorations so that they're slightly off the screen. LayoutOffset works fine, thanks!
    Minor ux complaint: it doesn't have default values of 0.dp, so you always need to specify both x and y values.
    l

    Leland Richardson [G]

    2 years ago
    yeah, good point
    Mihai Popa

    Mihai Popa

    2 years ago
    Yes,
    LayoutOffset
    is the correct replacement for any padding that is only intended to offset the position
    Thanks for the feedback regarding the API, we had deliberately decided to not put defaults, but your input is useful as we might decide to change it in the future 🙂