Skip to content

Clean-up Flexbox Layout algorithm implementation #39

@NickAcPT

Description

@NickAcPT

Problem

While browsing the implementation of the algorithm in this project, I noticed some things that probably should be cleaned up in the future.

Missing Implementation

There's a few steps that are not implemented yet and probably should be.

https://github.com/DioxusLabs/stretch/blob/a50a4569c5dbcebdcb77408f804d9bf90ccdc508/src/algo.rs#L296-L302

https://github.com/DioxusLabs/stretch/blob/a50a4569c5dbcebdcb77408f804d9bf90ccdc508/src/algo.rs#L304-L310

https://github.com/DioxusLabs/stretch/blob/a50a4569c5dbcebdcb77408f804d9bf90ccdc508/src/algo.rs#L304-L310

Out of spec Implementation

It seems like there's some steps in the implemented algorithm that are outside of the Flexbox specification.

https://github.com/DioxusLabs/stretch/blob/a50a4569c5dbcebdcb77408f804d9bf90ccdc508/src/algo.rs#L269-L270

https://github.com/DioxusLabs/stretch/blob/a50a4569c5dbcebdcb77408f804d9bf90ccdc508/src/algo.rs#L360-L363

https://github.com/DioxusLabs/stretch/blob/a50a4569c5dbcebdcb77408f804d9bf90ccdc508/src/algo.rs#L454-L455

https://github.com/DioxusLabs/stretch/blob/a50a4569c5dbcebdcb77408f804d9bf90ccdc508/src/algo.rs#L605-L609

Tight coupling

Maintainability of the Flexbox algorithm in the future is important, more so if more algorithms are implemented side-by-side next to it.
Thus, I think that the flexbox (and future) algorithm implementation(s) should be divided by steps.
While it requires more code to setup and do properly, it will allow to have simpler and shorter methods for each step of the layouting.

I hope I didn't miss anything, first time I am opening an issue here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions