Thread
#compose
    Fudge

    Fudge

    3 years ago
    It appears that having multiple children under
    Surface
    crashes the app
    May be because I have an old version
    Andrey Kulikov

    Andrey Kulikov

    3 years ago
    yeah, probably you are getting IllegalStateException("Surface can have only one direct measurable child!"), right?
    Fudge

    Fudge

    3 years ago
    No error, the app just closes
    Andrey Kulikov

    Andrey Kulikov

    3 years ago
    I mean in logs you can see this error message
    Anyway, yes, it is intended behavior now. Some of the layout components would assume they have at most one layout children, including Surface. I also would suggest you to not use Surface directly but, for example, Card. Then you are add inside a layout you need like Column or Row
    We will work more on how we can communicate better about this limitation later. For example studio would suggest that you can't add two child Layouts inside such types of Layouts of so
    Fudge

    Fudge

    3 years ago
    Are you planning to add a
    @Child
    (singular
    Children
    ) annotation to make this a compile-time error?
    That's the way Flutter does it (conceptually)
    Andrey Kulikov

    Andrey Kulikov

    3 years ago
    we plan to add something to solve it. not sure about the exact way
    Fudge

    Fudge

    3 years ago
    Oh, I can see the error now
    l

    Leland Richardson [G]

    3 years ago
    ideally we make this a compile-time error, yes. this is a bit harder to do for us than flutter because of our API, but something we are keeping in mind. I believe once we have proper inferencing for composables that this might fall out, but i’m not sure
    i’m also wanting us to think deeper about whether or not this is a real requirement we want to keep for some of these material components, but i haven’t looked at why we actually have these constraints yet
    Fudge

    Fudge

    3 years ago
    The thing that came into my mind is direction
    Do we lay it out as a column or a row?
    You could default it to a column, I think that's how it is in HTML
    l

    Leland Richardson [G]

    3 years ago
    yeah
    another option is to just layout absolutely by default, and only stack vertical/horizontal if you specify
    Fudge

    Fudge

    3 years ago
    What do you mean by "absolutely"?
    Andrey Kulikov

    Andrey Kulikov

    3 years ago
    like FrameLayout does probably. but with top left gravity everytime