Skip to content

Flexbox hardening: smart column stretch + grow/basis tokens + WText baseline#97

Merged
anilcancakir merged 9 commits into
masterfrom
feat/flexbox-stretch-wtext
Jun 8, 2026
Merged

Flexbox hardening: smart column stretch + grow/basis tokens + WText baseline#97
anilcancakir merged 9 commits into
masterfrom
feat/flexbox-stretch-wtext

Conversation

@anilcancakir

@anilcancakir anilcancakir commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Flexbox foundation hardening + WText baseline robustness

Addresses the reported "child doesn't take width without w-full inside a flex" pain point + makes WText self-sufficient, with an A-to-Z flexbox test suite.

Smart column cross-axis stretch (the headline)

A flex flex-col with no explicit items-* now stretches each width-less WDiv child to the column width by default (CSS align-items: stretch) — no w-full needed. Scoped for safety (oracle-reviewed):

  • Per-child SizedBox(width: infinity), not a parent crossAxisAlignment flip, so explicit-width (w-32/w-1/2/w-full), flex-*, shrink-0/flex-none, and absolute children keep their own sizing; items-start/items-center opts out; non-WDiv children untouched.
  • Column-only. Rows keep start (cross-axis = height = RenderFlex-crash-prone); items-stretch stays the Row opt-in.
  • Crash-guarded. A bounded-width LayoutBuilder (only for stretch-eligible columns) gates the wrap; an unbounded-width column degrades to content-sized children instead of forcing an infinite width. (This guard was added after review — an empirical probe caught that SizedBox(infinity) throws under unbounded width, which the reviewers' static analysis missed.)

New flex tokens + fix

  • grow / grow-0 (Tailwind shorthands); basis-* (1/2, 1/3, 1/4, full, [Npx]) → initial main-axis size (approximates flex-basis; documented).
  • flex-none corrected to flex: 0 0 auto (no grow, no shrink) — previously mapped to a shrinking FlexFit.

WText baseline robustness

A bare WText (no Material/Scaffold ancestor) no longer shows Flutter's debug yellow-underline: it falls back to a brightness-aware color (white on dark, black on light) and injects Directionality(ltr) when none is inherited. Explicit text-*/foregroundColor/textStyle still win.

Tests

  • test/flex/flexbox_scenarios_test.dart — 15 canonical Tailwind flexbox layouts (navbar/media-object/holy-grail/sticky-footer/centered/responsive/card/toolbar/wrap-grid/form-row/pricing/chip-list/split/list-item/hero) asserting real geometry.
  • New stretch/token/baseline tests incl. the unbounded-width regression, basis-not-double-stretched, and dark-mode baseline.

Verification

dart analyze 0 · dart format no diff · flutter test 1305 pass (+19) · coverage 90.5% · publish dry-run 0 warnings · pana 160/160 wasm-ready.

5-surface sync applied (CHANGELOG, doc/layout/flexbox, skill v2.0.4 + tokens/layouts/divergence, example gallery). Planned/executed via /ac:plan/ac:execute (complex, auto); deep-review + oracle both APPROVED.

Independent of the open PRs #96 (final-QA suites) and the WText/flex work here is its own branch.

Summary by CodeRabbit

  • New Features

    • Added basis-* utility tokens for flexible flex-basis sizing (fractional and fixed pixel values).
    • Added grow/grow-0 tokens as aliases for flex growth control.
    • Implemented smart cross-axis stretch behavior for flex-col containers.
  • Bug Fixes

    • Fixed WText rendering to safely handle missing MaterialApp, Scaffold, or Directionality ancestors.
    • Corrected flex-none semantics to prevent unintended shrinking.
  • Documentation

    • Updated layout and token references with basis guidance and stretch behavior clarification.

A bare WText (no Scaffold/MaterialApp) now falls back to Colors.black and
injects a Directionality(ltr) when none is inherited, instead of Flutter's
debug yellow-underline. Explicit text-*/foregroundColor/textStyle still win.
Route grow/grow-0/basis-* through canParse; grow=flex:1, basis-* sets the
child's initial main-axis size (WindStyle.basisFactor/basisSize). flex-none
(CSS flex:0 0 auto) no longer maps to a shrinking FlexFit.
flex-col with no explicit items-* now wraps each width-less WDiv child in
SizedBox(width: infinity) so it fills the column (CSS align-items: stretch
default); explicit-width/flex/absolute children and Rows are untouched. basis-*
resolves against the flex's measured main extent.
CHANGELOG, doc/layout/flexbox, and the wind-ui skill (SKILL.md v2.0.4 +
tokens/layouts/divergence refs) document the new flex defaults and WText fix.
In-process geometry suite covering navbar/media-object/holy-grail/sticky-footer/
centered/responsive/card/toolbar/wrap-grid/form-row/pricing/chip-list/split/
list-item/hero; asserts flex-1 distribution, shrink-0 intrinsic size, column
smart-stretch fill, alignment, and md: responsive flips.
Extend the layout/flex_grow gallery page with grow vs grow-0, basis-* fractional
sizing, and a smart-column-stretch section (flex-col children fill width by
default vs items-start sizing to content).
…ness-aware WText baseline

Post-review fixes:
- Smart column stretch wrapped children in SizedBox(width: infinity), which
  THREW under an unbounded-width column (bare Row slot / UnconstrainedBox /
  horizontal scroll). Gate the stretch on a finite incoming maxWidth via a
  LayoutBuilder (only when a stretch-eligible child exists); unbounded columns
  now degrade to content-sized children instead of crashing. Regression test
  added.
- WText baseline fallback is now brightness-aware (white on dark, black on
  light) instead of an always-black color that was invisible on dark
  backgrounds without a Material ancestor.
- Add basis-not-double-stretched + dark-baseline + bounded-scroll tests.
Copilot AI review requested due to automatic review settings June 8, 2026 17:15
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR introduces flex-basis utility token parsing and rendering for Wind flex layouts, adds smart cross-axis column stretching for WDiv children, hardens WText baseline color and Directionality handling, and provides comprehensive documentation and integration tests for the 1.0.0 release.

Changes

Flex-Basis & Text Rendering Enhancements

Layer / File(s) Summary
Flex-Basis Parsing Foundation
lib/src/parser/parsers/flexbox_grid_parser.dart, test/parser/parsers/flexbox_grid_parser_test.dart
Parser gains basis-<fraction>, basis-full, and arbitrary basis-[Npx] regex patterns; parses fractional/pixel basis into basisFactor/basisSize fields; removes flex-none from FlexFit mapping; detects grow/grow-0 aliases. Tests validate token recognition and field assignment for all basis variants.
WindStyle Flex-Basis Data Shape
lib/src/parser/wind_style.dart
WindStyle gains nullable basisFactor and basisSize fields with constructor/copyWith support, equality checks, and toString() serialization.
WDiv Flex Layout: Basis Resolution & Smart Stretch
lib/src/widgets/w_div.dart, test/widgets/w_div/flex_tokens_test.dart, test/widgets/w_div/flex_stretch_test.dart
_buildFlexStructure detects basis-* children, wraps flex in LayoutBuilder to resolve main-axis extent, and applies fixed-size SizedBox wrapping to basis children. _composeFlex centralizes row/column rendering: columns implement smart cross-axis stretch via SizedBox(width: infinity) for eligible WDiv children (gated by finite incoming width to avoid crashes), rows wrap flex children via basis-resolved pipeline. Token parsing tightened for shrink-0/flex-none variants. Tests validate grow/grow-0/basis-* token behavior, column stretch eligibility, and edge cases (unbounded width, scroll context, flex-1 compatibility).
WText Baseline Color & Directionality Guarantee
lib/src/widgets/w_text.dart, test/widgets/w_text/baseline_test.dart
_buildCoreContent applies brightness-dependent default color (white on dark, black otherwise) when resolved TextStyle.color is null, refactors early returns to local textWidget assignment, and wraps output in Directionality(textDirection: TextDirection.ltr, ...) when ancestor is absent. Tests verify baseline color fallback in bare contexts, Directionality robustness, and explicit style (text-*, foregroundColor, textStyle.color) precedence.
Documentation & Interactive Examples
CHANGELOG.md, doc/layout/flexbox.md, example/lib/pages/layout/flex_grow.dart, skills/wind-ui/*
CHANGELOG documents new flex tokens, smart stretch, and WText fallback. Flexbox.md expands grow/basis reference table and adds smart stretch note. Example pages add grow-vs-grow-0 and basis split demos with new _BasisRow and _StretchDemo widgets. Skill references updated with constraint model rules, divergence table entries, and token table.
Comprehensive Flexbox Scenario Integration Tests
test/flex/flexbox_scenarios_test.dart
New 15-scenario test suite validates canonical Tailwind flexbox patterns: grow/shrink behavior, responsive md: breakpoints, column smart stretch, footer pinning, split pane layouts, and text ordering. Tests pump themed WDiv trees, assert no exceptions, and validate positioning/sizing via tester geometry queries and text paint order helpers.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • fluttersdk/wind#90: Both PRs modify WindStyle constructor and fields (this PR adds basisFactor/basisSize properties, prior PR removed provenance-related fields), sharing code-level type-signature changes.

Poem

🐰 A flex-basis hop and a stretch so wide,

Cross-axis kids ride with column pride,

And WText shines, no darkness gray,

With baseline colors bright as day! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the three main features: flexbox hardening with smart column stretch, new grow/basis tokens, and WText baseline improvements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/flexbox-stretch-wtext

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


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

@sentry

sentry Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.80000% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/src/parser/wind_style.dart 50.00% 4 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

Hardens Wind’s flexbox behavior and documentation by adding column-only cross-axis stretch defaults, introducing new flex sizing tokens (grow, grow-0, basis-*), and making WText render robustly even without a Material/Scaffold ancestor. This fits Wind’s goal of providing Tailwind-like, utility-first layout semantics with predictable Flutter widget-tree composition.

Changes:

  • Adds “smart column stretch” for flex flex-col so width-less WDiv children default to filling the column width (CSS-like align-items: stretch behavior), with guards for unbounded width.
  • Introduces/extends flex child sizing tokens (grow, grow-0, basis-*) and corrects flex-none semantics, plus updates WindStyle to carry basis metadata.
  • Improves WText baseline rendering by guaranteeing a non-null color fallback and injecting Directionality when missing; adds extensive geometry/baseline test coverage and updates docs/skill references/examples.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
lib/src/widgets/w_div.dart Implements smart column stretch and main-axis basis-* sizing; adjusts Row shrink-wrapping behavior.
lib/src/parser/parsers/flexbox_grid_parser.dart Adds parsing support for grow/grow-0 and basis-*, and updates flex token docs in-parser.
lib/src/parser/wind_style.dart Adds basisFactor / basisSize to the immutable style model.
lib/src/widgets/w_text.dart Adds baseline color fallback + missing Directionality injection for bare WText rendering.
test/widgets/w_text/baseline_test.dart New widget tests covering bare-context WText color + directionality guarantees.
test/widgets/w_div/flex_tokens_test.dart New widget tests for grow, grow-0, basis-*, and corrected flex-none.
test/widgets/w_div/flex_stretch_test.dart New widget tests for column-only smart stretch + edge cases (bounded/unbounded width).
test/parser/parsers/flexbox_grid_parser_test.dart Extends parser tests to cover grow/grow-0, basis-*, and flex-none expectations.
test/flex/flexbox_scenarios_test.dart Adds a broad, geometry-based suite of canonical flexbox scenario tests.
doc/layout/flexbox.md Documents new column-stretch default and new/updated flex sizing tokens.
example/lib/pages/layout/flex_grow.dart Updates example page to demonstrate grow, grow-0, basis-*, and smart column stretch.
skills/wind-ui/SKILL.md Bumps skill version metadata to v2.0.4.
skills/wind-ui/references/tokens.md Updates token reference docs for flex-none, grow-0, and basis-*.
skills/wind-ui/references/layouts.md Adds guidance about default column stretching semantics.
skills/wind-ui/references/tailwind-divergence.md Documents new flex-none/basis-* support and updates WText baseline note.
CHANGELOG.md Adds release notes for grow/basis/stretch and WText baseline changes.

Comment on lines +158 to +161
/// Guarantees two baseline requirements when no Material/Scaffold ancestor
/// is present so Flutter's debug yellow-underline fallback never appears:
/// 1. A non-null text color (falls back to [Colors.black]).
/// 2. A [Directionality] ancestor (defaults to [TextDirection.ltr]).
| `text-7xl` / `8xl` / `9xl` | silently capped (max is `text-6xl`) | `text-6xl` or arbitrary `text-[96px]` |

Reminder: a wind page needs a Material ancestor (a `Scaffold`) for `WText` to inherit a default text style; without one, Flutter renders the yellow-underline fallback. Real apps always have a `Scaffold`, so this only bites bare `WDiv > WText` route bodies.
Note: `WText` is self-contained regarding its baseline rendering. When no Material/Scaffold ancestor supplies a `DefaultTextStyle` color, `WText` falls back to `Colors.black` internally; it also injects a `Directionality(ltr)` wrapper when no `Directionality` is inherited. Explicit `text-*` className, `foregroundColor`, and `textStyle` props override the fallback and are unaffected.
Comment thread CHANGELOG.md Outdated

### Fixed

- `WText` bare rendering: a `WText` used outside a `MaterialApp` / `Scaffold` now renders with a baseline `Colors.black` color instead of Flutter's debug yellow-underline fallback. When no `Directionality` ancestor exists, `WText` injects one defaulting to `TextDirection.ltr`. Explicitly supplied colors (`className text-*`, `foregroundColor`, `textStyle`) still win and are unaffected.
Comment thread lib/src/widgets/w_div.dart Outdated
Comment on lines +840 to +844
if (_hasFlexClass(className)) return false;
if (_hasExplicitCrossWidth(className, context)) return false;
if (className != null &&
className.isNotEmpty &&
className.contains('absolute')) {
Comment thread lib/src/widgets/w_div.dart Outdated
Comment on lines +809 to +818
static bool _hasExplicitCrossWidth(String? className, BuildContext context) {
if (className == null || className.isEmpty) return false;
final styles = WindParser.parse(className, context);
return styles.width != null ||
styles.widthFactor != null ||
(styles.constraints?.minWidth != null &&
styles.constraints!.minWidth > 0) ||
(styles.constraints?.maxWidth != null &&
styles.constraints!.maxWidth != double.infinity);
}
Comment on lines +292 to +296
// `basis-1/2`, `basis-full` (fractional) and `basis-[120px]` (fixed).
// Arbitrary precedes the theme/fraction form per the parser convention.
if (basisFactor == null && basisSize == null) {
final arbitraryMatch = _basisArbitraryRegex.firstMatch(className);
if (arbitraryMatch != null) {

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lib/src/widgets/w_text.dart`:
- Around line 157-161: Update the doc comment above the widget that guarantees
baseline requirements (the comment describing non-null text color and
Directionality) to reflect the actual brightness-aware fallback implemented in
the code: instead of stating it falls back to Colors.black, note that the
implementation selects Colors.white for dark platform brightness and
Colors.black for light brightness (referencing the code paths that use
Colors.white / Colors.black when computing the default text color), while still
guaranteeing a non-null text color and a default TextDirection.ltr when no
Material/Scaffold ancestor is present.

In `@skills/wind-ui/references/tailwind-divergence.md`:
- Line 341: The note about WText's baseline fallback is inaccurate: update the
comment text referencing WText (and its baseline rendering and DefaultTextStyle
behavior) to state that the fallback color is brightness-dependent — i.e., WText
uses Colors.white on dark platforms and Colors.black on light platforms (unless
overridden by explicit text-* className, foregroundColor, or textStyle);
alternatively, add the phrase "brightness-dependent fallback" so readers
understand it's conditional rather than always black.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 459fd2d0-7878-4137-a567-c52e201805d5

📥 Commits

Reviewing files that changed from the base of the PR and between c817f15 and 56e9a5d.

📒 Files selected for processing (16)
  • CHANGELOG.md
  • doc/layout/flexbox.md
  • example/lib/pages/layout/flex_grow.dart
  • lib/src/parser/parsers/flexbox_grid_parser.dart
  • lib/src/parser/wind_style.dart
  • lib/src/widgets/w_div.dart
  • lib/src/widgets/w_text.dart
  • skills/wind-ui/SKILL.md
  • skills/wind-ui/references/layouts.md
  • skills/wind-ui/references/tailwind-divergence.md
  • skills/wind-ui/references/tokens.md
  • test/flex/flexbox_scenarios_test.dart
  • test/parser/parsers/flexbox_grid_parser_test.dart
  • test/widgets/w_div/flex_stretch_test.dart
  • test/widgets/w_div/flex_tokens_test.dart
  • test/widgets/w_text/baseline_test.dart

Comment on lines +157 to +161
///
/// Guarantees two baseline requirements when no Material/Scaffold ancestor
/// is present so Flutter's debug yellow-underline fallback never appears:
/// 1. A non-null text color (falls back to [Colors.black]).
/// 2. A [Directionality] ancestor (defaults to [TextDirection.ltr]).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update documentation to reflect brightness-aware color fallback.

The documentation states the fallback is Colors.black, but the implementation (lines 186-191) actually chooses between Colors.white (dark) and Colors.black (light) based on platform brightness. Update the comment to match the implementation.

📝 Proposed documentation fix
   /// Guarantees two baseline requirements when no Material/Scaffold ancestor
   /// is present so Flutter's debug yellow-underline fallback never appears:
-  ///   1. A non-null text color (falls back to [Colors.black]).
+  ///   1. A non-null text color (falls back to white on dark, black on light).
   ///   2. A [Directionality] ancestor (defaults to [TextDirection.ltr]).
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
///
/// Guarantees two baseline requirements when no Material/Scaffold ancestor
/// is present so Flutter's debug yellow-underline fallback never appears:
/// 1. A non-null text color (falls back to [Colors.black]).
/// 2. A [Directionality] ancestor (defaults to [TextDirection.ltr]).
///
/// Guarantees two baseline requirements when no Material/Scaffold ancestor
/// is present so Flutter's debug yellow-underline fallback never appears:
/// 1. A non-null text color (falls back to white on dark, black on light).
/// 2. A [Directionality] ancestor (defaults to [TextDirection.ltr]).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/src/widgets/w_text.dart` around lines 157 - 161, Update the doc comment
above the widget that guarantees baseline requirements (the comment describing
non-null text color and Directionality) to reflect the actual brightness-aware
fallback implemented in the code: instead of stating it falls back to
Colors.black, note that the implementation selects Colors.white for dark
platform brightness and Colors.black for light brightness (referencing the code
paths that use Colors.white / Colors.black when computing the default text
color), while still guaranteeing a non-null text color and a default
TextDirection.ltr when no Material/Scaffold ancestor is present.

| `text-7xl` / `8xl` / `9xl` | silently capped (max is `text-6xl`) | `text-6xl` or arbitrary `text-[96px]` |

Reminder: a wind page needs a Material ancestor (a `Scaffold`) for `WText` to inherit a default text style; without one, Flutter renders the yellow-underline fallback. Real apps always have a `Scaffold`, so this only bites bare `WDiv > WText` route bodies.
Note: `WText` is self-contained regarding its baseline rendering. When no Material/Scaffold ancestor supplies a `DefaultTextStyle` color, `WText` falls back to `Colors.black` internally; it also injects a `Directionality(ltr)` wrapper when no `Directionality` is inherited. Explicit `text-*` className, `foregroundColor`, and `textStyle` props override the fallback and are unaffected.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Clarify brightness-dependent baseline color fallback.

The note states WText "falls back to Colors.black internally," but the implementation applies a brightness-aware fallback: Colors.white on dark platforms and Colors.black on light platforms. The test suite confirms this behavior (baseline_test.dart line 73-90: "white on dark").

Consider updating the note to reflect the conditional fallback or at least mention "brightness-dependent" so readers don't assume it's always black.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@skills/wind-ui/references/tailwind-divergence.md` at line 341, The note about
WText's baseline fallback is inaccurate: update the comment text referencing
WText (and its baseline rendering and DefaultTextStyle behavior) to state that
the fallback color is brightness-dependent — i.e., WText uses Colors.white on
dark platforms and Colors.black on light platforms (unless overridden by
explicit text-* className, foregroundColor, or textStyle); alternatively, add
the phrase "brightness-dependent fallback" so readers understand it's
conditional rather than always black.

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 16 out of 16 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

lib/src/widgets/w_div.dart:858

  • _hasFlexClass only checks for flex-1..flex-5 via substring matches. The parser supports any flex-N, and there are other self-wrapping flex tokens (shrink, flex-auto, etc.). Missing these can cause the parent Row/Column logic to wrap a child that will also self-wrap in Expanded/Flexible, leading to ParentDataWidget assertion failures (and also breaks the new smart-stretch skip logic for flex children).
  static bool _hasFlexClass(String? className) {
    if (className == null) return false;
    return className.contains('flex-1') ||
        className.contains('flex-2') ||
        className.contains('flex-3') ||
        className.contains('flex-4') ||
        className.contains('flex-5');
  }

Comment thread lib/src/widgets/w_div.dart Outdated
Comment on lines +809 to +812
static bool _hasExplicitCrossWidth(String? className, BuildContext context) {
if (className == null || className.isEmpty) return false;
final styles = WindParser.parse(className, context);
return styles.width != null ||
Comment thread lib/src/widgets/w_div.dart Outdated
Comment on lines +840 to +842
if (_hasFlexClass(className)) return false;
if (_hasExplicitCrossWidth(className, context)) return false;
if (className != null &&
Comment on lines +158 to +161
/// Guarantees two baseline requirements when no Material/Scaffold ancestor
/// is present so Flutter's debug yellow-underline fallback never appears:
/// 1. A non-null text color (falls back to [Colors.black]).
/// 2. A [Directionality] ancestor (defaults to [TextDirection.ltr]).
| `text-7xl` / `8xl` / `9xl` | silently capped (max is `text-6xl`) | `text-6xl` or arbitrary `text-[96px]` |

Reminder: a wind page needs a Material ancestor (a `Scaffold`) for `WText` to inherit a default text style; without one, Flutter renders the yellow-underline fallback. Real apps always have a `Scaffold`, so this only bites bare `WDiv > WText` route bodies.
Note: `WText` is self-contained regarding its baseline rendering. When no Material/Scaffold ancestor supplies a `DefaultTextStyle` color, `WText` falls back to `Colors.black` internally; it also injects a `Directionality(ltr)` wrapper when no `Directionality` is inherited. Explicit `text-*` className, `foregroundColor`, and `textStyle` props override the fallback and are unaffected.
Comment thread CHANGELOG.md Outdated

### Fixed

- `WText` bare rendering: a `WText` used outside a `MaterialApp` / `Scaffold` now renders with a baseline `Colors.black` color instead of Flutter's debug yellow-underline fallback. When no `Directionality` ancestor exists, `WText` injects one defaulting to `TextDirection.ltr`. Explicitly supplied colors (`className text-*`, `foregroundColor`, `textStyle`) still win and are unaffected.
…ren; honor last-class-wins for no-grow/no-shrink resets

Address PR #97 review (Copilot + CodeRabbit):

B (crash): a column smart-stretch SizedBox or a Row Flexible wrapped a child
that self-wraps in Expanded/Flexible (grow, flex-grow, flex-auto, flex-initial,
shrink, flex-shrink, flex-N), throwing 'Incorrect use of ParentDataWidget'.
The old _hasFlexClass only matched flex-1..5 and missed every newly-added
token. Replaced it with prefix-agnostic _selfWrapsInFlex used by both the
column stretch gate and the row Flexible gate, so md:grow / hover:flex-1 are
caught too. Empirically reproduced (column grow/flex-auto, row grow all
asserted) before the fix; regression suite in test/flex/flex_self_wrap_test.dart.

C: _hasExplicitCrossWidth now scans tokens prefix-agnostically so a
state/breakpoint-conditional width (hover:w-32, md:max-w-sm) still disables the
stretch wrap; dropped the unused context parse.

D (last-class-wins): grow-0 / shrink-0 / flex-none now claim their flex/flexFit
slot with a null value during reverse iteration, so a later no-grow/no-shrink
token cancels an earlier grow/shrink instead of being silently ignored.
flex-none cancels both. Updated the two parser tests that encoded the old
(order-independent) behavior.

A (docs): WText baseline fallback is brightness-aware (white on dark, black on
light); corrected the w_text docstring, tailwind-divergence, CHANGELOG. Also
corrected the smart-stretch exclusion list in CHANGELOG, doc/layout/flexbox,
and skills/layouts: shrink-0/flex-none DO stretch cross-axis (flex-shrink is
main-axis only, matching CSS).

dart analyze 0 issues; dart format clean; flutter test 1323 pass; coverage 90.6%.
…h-wtext

# Conflicts:
#	skills/wind-ui/references/tailwind-divergence.md
@anilcancakir anilcancakir merged commit b71be3c into master Jun 8, 2026
8 checks passed
@anilcancakir anilcancakir deleted the feat/flexbox-stretch-wtext branch June 8, 2026 18:13
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