louiscad

    louiscad

    2 years ago
    Isn't
    Modifier
    the new
    LayoutParams
    in a way?
    v

    Vinay Gaba

    2 years ago
    I think Modifiers do a lot more than just that.
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    2 years ago
    Kinda, yea. It's not an exact 1:1 relationship, but it is one of their use cases.
    Adam Powell

    Adam Powell

    2 years ago
    Kind of a fusion of LayoutParams and the assortment of general-purpose properties that accumulated on the
    View
    class over the years, but with (ideally) less of a fragile base class problem
    louiscad

    louiscad

    2 years ago
    @Adam Powell You mean more… composable?
    r

    romainguy

    2 years ago
    It’s so much more 😛
    To me modifiers are closer to the concept of components in Entity-Component Systems
    Adam Powell

    Adam Powell

    2 years ago
    @louiscad yes, the strong ordering property is a big part of what creates that composability and why I think it's worth the tradeoff of explaining why we don't have a fixed ordering of position-independent margin/padding 🙂
    louiscad

    louiscad

    2 years ago
    It’s so much more 😛
    So much or too much? Regardless, I'm wondering about the discoverability of these abilities (at least, the built-in ones). (I'm waiting for the next dev version that will work on Kotlin 1.4-rc to start playing with compose dev serioulsy, I'll probably see myself, event though it may change in subsequent releases)
    v

    Vinay Gaba

    2 years ago
    The mental model I’ve been using is that they are “component decorators”. Any time I want to add more UI functionality(gestures, appearance, etc) to a composable, I either look for an existing Modifier or try to think about how a custom modifier might be useful. And I rarely ever need custom modifiers for now 😛
    r

    romainguy

    2 years ago
    I don’t think discoverability is any worse than with regular composable functions. It might actually be better thanks to the code completion context provided by chaining modifiers
    How we present them in the docs is a different problem though