Skip to content

min and max methods for Length#3367

Open
hecrj wants to merge 23 commits into
masterfrom
bounded-length
Open

min and max methods for Length#3367
hecrj wants to merge 23 commits into
masterfrom
bounded-length

Conversation

@hecrj

@hecrj hecrj commented Jun 18, 2026

Copy link
Copy Markdown
Member

This PR introduces min and max methods to the Length type, allowing users to define minimum and maximum constraints for any widget:

row![
    container(sidebar).width(Fill.min(150).max(200)),
    container(content).width(FillPortion(3).min(300)),
]

The implementation involved introducing additional min/max passes to our flex layout logic, as well as changing the sizing inheritance of widgets to account for constraint propagation over each axis. However, while elements may be visited multiple times, layout is only ever called once for each of them; keeping the single-pass layout philosophy of the library intact.

The changes here also introduce a bunch of new layout integration tests, which should freeze the requirements of the flex logic and the layout system to avoid future regressions.

I suspect there may be plenty of edge cases that the current logic does not handle well; so we will likely have to iterate a bunch.

@hecrj hecrj added this to the 0.15 milestone Jun 18, 2026
@hecrj hecrj added bug Something isn't working feature New feature or request layout addition fix labels Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

addition bug Something isn't working feature New feature or request fix layout

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant