feat(layout): intrinsic-safe flex stretch and min-width-stretch scroll (WIND-4)#149
Conversation
|
Warning Review limit reached
Next review available in: 37 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (14)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR updates Wind’s layout internals to remove intrinsic-unsafe LayoutBuilder paths in WDiv flex layout, adds a horizontal “min-width-stretch” scroll primitive for responsive tables, and introduces a dev-time assert to catch h-full misuse inside vertical scrolls.
Changes:
- Replace intrinsic-unsafe flex behaviors with render-object based primitives (
WindCrossStretch,WindMainExtentProvider/WindFractionBasis) and updateWDivto use them. - Add “fill on desktop, scroll on narrow” behavior for
overflow-x-auto+w-full min-w-[Npx]via a viewport-width port threaded through an inherited scope. - Add/extend tests, docs, examples, skill references, and changelog entries to reflect the new behavior and guarantees.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/flex/intrinsic_safe_layout_test.dart | New widget tests covering intrinsic-safe flex, fractional basis behavior, responsive horizontal scroll sizing, and the new h-full-in-scroll assert. |
| skills/wind-ui/SKILL.md | Bumps skill version metadata to 2.9.0. |
| skills/wind-ui/references/tailwind-divergence.md | Updates divergence notes for intrinsic-safe flex, responsive table scroll pattern, and the new h-full assert behavior. |
| skills/wind-ui/references/layouts.md | Updates guidance around IntrinsicHeight and clarifies which Wind flex paths are now intrinsic-safe vs. still constrained. |
| lib/src/widgets/wind_min_width_scroll.dart | New render-object widgets/ports to publish viewport width and size w-full content inside horizontal scrolls. |
| lib/src/widgets/wind_equal_height_row.dart | Adds render-object primitives for intrinsic-safe column stretch and fractional basis-* sizing against flex extent. |
| lib/src/widgets/w_div.dart | Integrates new render-object primitives, threads scroll scope signals, and adds the h-full inside vertical scroll assert + horizontal scroll w-full sizing. |
| lib/src/state/wind_min_width_scroll_scope.dart | New InheritedWidget for threading scroll axis/viewport width info to descendants. |
| example/lib/routes.dart | Registers the new responsive table example route. |
| example/lib/pages/layout/responsive_table.dart | New example page demonstrating responsive table scroll and explicit items-stretch columns. |
| doc/layout/overflow.md | Documents the responsive-table scroll composition and the new h-full-in-vertical-scroll assert behavior. |
| doc/layout/flexbox.md | Updates flexbox docs to reflect intrinsic-safe flex internals and explicit items-stretch semantics. |
| CHANGELOG.md | Adds WIND-4 entries describing intrinsic-safe flex, min-width-stretch horizontal scroll, items-stretch behavior, and the h-full assert. |
… viewport When the scroll viewport width is unpublished (null) or infinite (the scroll sits in an unbounded-width context), the box no longer forces a tight (possibly 0) width that collapses a w-full child. It now lays the child out with the min-w-* floor as a lower bound and content width as the upper, mirroring WindCrossStretch / WindFractionBasis. Adds direct RenderObject tests for the finite / floor / null / infinite viewport cases.
|
@coderabbitai review |
✅ Action performedReview finished.
|
The unbounded/unpublished-viewport degradation laid the child out with maxWidth double.infinity and reported size = child.size, which could exceed a finite parent constraint (box used outside a scroll, or before a finite viewport publishes) and trip 'size not within constraints'. Both branches now clamp the floor/target into the incoming width range and re-constrain the reported size. Adds a finite-parent regression test.
…plicate test-group label The w_div basis comment still described the removed LayoutBuilder path; it now points at WindMainExtentProvider. The second flex test group no longer reuses the '(a)' label.
|
@coderabbitai review |
✅ Action performedReview finished.
|
…-flex-min-width-scroll # Conflicts: # CHANGELOG.md
Directly exercises WindCrossStretch (bounded + unbounded), the column WindMainExtentProvider / WindFractionBasis basis path, a basis-factor and a flex-direction rebuild (render-object update path), the WindMinWidthBox floor setter, and WindMinWidthScrollScope.updateShouldNotify. Lifts patch coverage of the new render objects; the few remaining lines are unreachable null-child guards.
What (WIND-4)
Three coupled layout capabilities plus an actionable assert:
w_divbasis-*and column-stretchLayoutBuilders (which threwLayoutBuilder does not support returning intrinsic dimensionsunder an intrinsic-measuring ancestor, cascading to_owner != nullon web) are replaced with real render objects:WindCrossStretch(aRenderProxyBoxstretch) andWindMainExtentProvider/WindFractionBasis(fractional basis resolved against the flex's own extent through a layout-time port). Aflex flex-colnow renders inside anitems-stretchgrid cell / underIntrinsicHeight/ in aTablecell without asserting.overflow-x-autowrapper +w-full min-w-[Npx]inner.w-fullinside a horizontal scroll now sizes tomax(viewport, min-w-*)instead of asserting on the scroll's unbounded width.flex flex-col items-stretch: equalizes child widths, closing the asymmetry withgrid ... items-stretch.h-full-in-vertical-scroll assert: a child resolvingh-fullunder anoverflow-y-auto/-scrollparent now fails fast with a message pointing atflex-1, threaded viaWindMinWidthScrollScope(dev-only, stripped in release).Why
Closes the LayoutBuilder-under-items-stretch crash (the uptizm CheckHistoryTable regression) and adds the missing responsive-table scroll primitive. Uses the intrinsic-free two-pass foundation already proven by
WindEqualHeightRow; noLayoutBuilderis reintroduced on any intrinsic-reachable path.Changes
lib/src/widgets/w_div.dart,wind_equal_height_row.dart; newlib/src/widgets/wind_min_width_scroll.dart,lib/src/state/wind_min_width_scroll_scope.dart.test/flex/intrinsic_safe_layout_test.dart(new): reproduces the crash underIntrinsicHeight/grid items-stretch, asserts fill/scroll widths (720 fills, 300 -> 600 scrolls), items-stretch equalization, and the h-full assert (incl. the "same-element h-full is allowed" case).SKILL.md(2.8.2 -> 2.9.0),references/layouts.md,references/tailwind-divergence.md(reconciles the now-false "LayoutBuilder internally" claim),doc/layout/flexbox.md,doc/layout/overflow.md,example/lib/pages/layout/responsive_table.dart(new),CHANGELOG.md.Verification
dart analyzeclean,dart formatclean,flutter testgreen (flex + pixel suites, including the items-stretch-ancestor and min-width-scroll cases).Follow-up (out of scope, flagged)
A pre-existing
h-fullLayoutBuilderin the sizing section (w_div.dart) remains for the genuine unbounded-height NON-scroll case (a bareh-fullunderIntrinsicHeightwith no scroll). Not introduced here (two flex-path LayoutBuilders were removed, none added); candidate for a future intrinsic-safe pass.Note
Shares
CHANGELOG.md/SKILL.md/tailwind-divergence.mdwith the WIND-1/5/3 PRs; whichever merges first, the others need a trivial rebase on those doc surfaces.