composablehorizons / compose-examples

This repository it used to keep track of user feedback, issues and suggestions for https://composablesui.com
https://composablesui.com
10 stars 0 forks source link

More details on how to work with/implement expandable card composables #4

Closed willnwalker closed 3 months ago

willnwalker commented 4 months ago

Would appreciate details on how to make expandable cards with a header element with constraints. Specifically implementing card headers that maintain an aspect ratio up to a certain width, and therefore have a maximum height (for larger displays where list items shouldn't get obscenely big). Also looking for a primer on how to work with animated visibility and growing/shrinking container composables (animating visibility for the expanded view of a card is tricky to understand)

alexstyl commented 4 months ago

Have u seen the ExpandableCard component?

willnwalker commented 4 months ago

Yes, this is a response to that component. I had to add an adaptive box for header images to scale properly which I felt some other users might want knowledge of how to implement. Would also love some more examples of how to nest container composables when using animation - was getting warnings in IDE of shadowing due to multiple columns, for instance.

willnwalker commented 4 months ago

Solution I arrived at was a composable that wrapped Box taking a maxHeight param. That param is used to constrain the nested box's height, and its width is established by aspect ratio by using size callback modifier until that maxHeight is reached, at which point it is allowed to grow horizontally without regard to the aspect ratio.

alexstyl commented 3 months ago

@willnwalker I need more context to understand your request.

If you have a specific component you would like to see (ie some specific UI patterns you have seen in an app), let me know.

What you are describing sounds like instructions of how to use specific APIs, which you can find in Compose's documentation.

If you don't have a specific component, kindly close this issue.