google / automotive-design-compose

Automotive Design for Compose is an extension to Jetpack Compose that allows every screen, component, and overlay of your Android App to be defined in Figma, and lets you see the latest changes to your Figma design in your app, immediately!
https://google.github.io/automotive-design-compose/
Apache License 2.0
101 stars 14 forks source link

Refactor the layout and figma_import crates #1006

Closed timothyfroehlich closed 4 weeks ago

timothyfroehlich commented 4 weeks ago

As a result of this change the figma_import crate now depends on the layout crate, instead of the layout crate depending on figma_import.

As a result, the layout crate now has no dependencies within the workspace.

layout's tests had to be moved to figma_import due to the tests heavy reliance on figma_import.

github-actions[bot] commented 4 weeks ago

Snapshot diff report vs base branch: main Last updated: Mon Apr 15 14:50:52 PDT 2024, Sha: 8024ec78fa54c9777219c6e85f8609d4f60d628e No differences detected

rylin8 commented 4 weeks ago

Not sure why there is both a styles.rs and types.rs?

timothyfroehlich commented 4 weeks ago

Not sure why there is both a styles.rs and types.rs?

Personal preference for smaller files. "Styles" was the best name I could think of for the enums, which is what they correspond to in Taffy. I would have called it layout_styles.rs but that's too close to layout_style.

rylin8 commented 4 weeks ago

Not sure why there is both a styles.rs and types.rs?

Personal preference for smaller files. "Styles" was the best name I could think of for the enums, which is what they correspond to in Taffy. I would have called it layout_styles.rs but that's too close to layout_style.

Sure but what goes in one vs the other? Like I don't get why Dimension is in one but JustifyContent is in the other.

timothyfroehlich commented 4 weeks ago

Not sure why there is both a styles.rs and types.rs?

Personal preference for smaller files. "Styles" was the best name I could think of for the enums, which is what they correspond to in Taffy. I would have called it layout_styles.rs but that's too close to layout_style.

Sure but what goes in one vs the other? Like I don't get why Dimension is in one but JustifyContent is in the other.

Because Dimension is a basic type and gives you positioning and JustifyContent is just one way you can lay out the content, just like AlignItems and so on.

It could be a bit more clear to rename types.rs to geometry.rs, I suppose.

rylin8 commented 4 weeks ago

Gave this a test and seems fine, so I'm good with it.