Skip to content

feat(layout): intrinsic-safe flex stretch and min-width-stretch scroll (WIND-4)#149

Merged
anilcancakir merged 9 commits into
masterfrom
feat/intrinsic-safe-flex-min-width-scroll
Jul 7, 2026
Merged

feat(layout): intrinsic-safe flex stretch and min-width-stretch scroll (WIND-4)#149
anilcancakir merged 9 commits into
masterfrom
feat/intrinsic-safe-flex-min-width-scroll

Conversation

@anilcancakir

Copy link
Copy Markdown
Collaborator

What (WIND-4)

Three coupled layout capabilities plus an actionable assert:

  1. Intrinsic-safe internal layout: the w_div basis-* and column-stretch LayoutBuilders (which threw LayoutBuilder does not support returning intrinsic dimensions under an intrinsic-measuring ancestor, cascading to _owner != null on web) are replaced with real render objects: WindCrossStretch (a RenderProxyBox stretch) and WindMainExtentProvider/WindFractionBasis (fractional basis resolved against the flex's own extent through a layout-time port). A flex flex-col now renders inside an items-stretch grid cell / under IntrinsicHeight / in a Table cell without asserting.
  2. Min-width-stretch scroll: a "fill on desktop, scroll on narrow" primitive composed from existing tokens (no new className): overflow-x-auto wrapper + w-full min-w-[Npx] inner. w-full inside a horizontal scroll now sizes to max(viewport, min-w-*) instead of asserting on the scroll's unbounded width.
  3. Explicit flex flex-col items-stretch: equalizes child widths, closing the asymmetry with grid ... items-stretch.
  4. h-full-in-vertical-scroll assert: a child resolving h-full under an overflow-y-auto/-scroll parent now fails fast with a message pointing at flex-1, threaded via WindMinWidthScrollScope (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; no LayoutBuilder is reintroduced on any intrinsic-reachable path.

Changes

  • lib/src/widgets/w_div.dart, wind_equal_height_row.dart; new lib/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 under IntrinsicHeight/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).
  • 5-surface doc sync: 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 analyze clean, dart format clean, flutter test green (flex + pixel suites, including the items-stretch-ancestor and min-width-scroll cases).

Follow-up (out of scope, flagged)

A pre-existing h-full LayoutBuilder in the sizing section (w_div.dart) remains for the genuine unbounded-height NON-scroll case (a bare h-full under IntrinsicHeight with 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.md with the WIND-1/5/3 PRs; whichever merges first, the others need a trivial rebase on those doc surfaces.

Copilot AI review requested due to automatic review settings July 7, 2026 14:13
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@anilcancakir, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 37 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2bd1f48d-2b8f-4a9e-ae4a-69b17db71361

📥 Commits

Reviewing files that changed from the base of the PR and between 11db93d and d182416.

📒 Files selected for processing (14)
  • CHANGELOG.md
  • doc/layout/flexbox.md
  • doc/layout/overflow.md
  • example/lib/pages/layout/responsive_table.dart
  • example/lib/routes.dart
  • lib/src/state/wind_min_width_scroll_scope.dart
  • lib/src/widgets/w_div.dart
  • lib/src/widgets/wind_equal_height_row.dart
  • lib/src/widgets/wind_min_width_scroll.dart
  • skills/wind-ui/references/layouts.md
  • skills/wind-ui/references/tailwind-divergence.md
  • test/flex/intrinsic_safe_layout_test.dart
  • test/flex/wind_min_width_scroll_test.dart
  • test/flex/wind_render_objects_test.dart
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/intrinsic-safe-flex-min-width-scroll

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.38220% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/src/widgets/wind_equal_height_row.dart 95.12% 4 Missing ⚠️
lib/src/widgets/wind_min_width_scroll.dart 98.33% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 update WDiv to 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.

Comment thread lib/src/widgets/wind_min_width_scroll.dart Outdated
Comment thread test/flex/intrinsic_safe_layout_test.dart Outdated
… 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.
@anilcancakir

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Comment thread lib/src/widgets/wind_min_width_scroll.dart
Comment thread lib/src/widgets/w_div.dart Outdated
Comment thread test/flex/intrinsic_safe_layout_test.dart Outdated
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.
@anilcancakir

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

…-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.
@anilcancakir anilcancakir merged commit 4311759 into master Jul 7, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants