Skip to content

Fix GridTile - #191656

Closed
kaluli123123 wants to merge 1 commit into
flutter:masterfrom
kaluli123123:fix-gridtile-unbounded-82055
Closed

kaluli123123 wants to merge 1 commit into
flutter:masterfrom
kaluli123123:fix-gridtile-unbounded-82055

Conversation

@kaluli123123

Copy link
Copy Markdown
Contributor

GridTile placed every child of its Stack in a Positioned widget, including the tile content. A Stack without any non-positioned child sizes itself to the biggest allowed size, which is infinite along the main axis of an unbounded parent such as a horizontally scrolling ListView. RenderStack then failed its size.isFinite assertion.

The tile content is now a non-positioned child of the Stack, and the Stack uses StackFit.passthrough so the content still receives the constraints the tile receives. The tile keeps filling the available space when the incoming constraints are tight (the GridView case), and shrink-wraps its content when they are unbounded instead of crashing.

Fixes #82055

Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.

List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages labels Aug 25, 2026
@github-actions

Copy link
Copy Markdown

This pull request contains changes to Material or Cupertino, which are currently frozen in this repository.

Changes should be made in material_ui and/or cupertino_ui in the flutter/packages repository.

Please refer to #188444 for instructions.

@google-cla

google-cla Bot commented Aug 25, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

GridTile placed every child of its Stack in a Positioned widget, including
the tile content. A Stack without any non-positioned child sizes itself to
the biggest allowed size, which is infinite along the main axis of an
unbounded parent such as a horizontally scrolling ListView. RenderStack then
failed its `size.isFinite` assertion.

The tile content is now a non-positioned child of the Stack, and the Stack
uses StackFit.passthrough so the content still receives the constraints the
tile receives. The tile keeps filling the available space when the incoming
constraints are tight (the GridView case), and shrink-wraps its content when
they are unbounded instead of crashing.

Fixes flutter#82055
@kaluli123123

Copy link
Copy Markdown
Contributor Author

Material is frozen in flutter/flutter (see #188444), so this is ported to flutter/packages instead. Closing this in favor of that PR.

@kaluli123123

Copy link
Copy Markdown
Contributor Author

Correcting the link above: ported to flutter/packages#12586.

QuncCccccc pushed a commit to kaluli123123/packages that referenced this pull request Oct 2, 2026
GridTile placed every child of its Stack in a Positioned widget, including
the tile content. A Stack without any non-positioned child sizes itself to
the biggest allowed size, which is infinite along the main axis of an
unbounded parent such as a horizontally scrolling ListView. RenderStack then
failed its size.isFinite assertion.

The tile content is now a non-positioned child of the Stack, and the Stack
uses StackFit.passthrough so the content still receives the constraints the
tile receives. The tile keeps filling the available space when the incoming
constraints are tight (the GridView case), and shrink-wraps its content when
they are unbounded instead of crashing.

Ported from flutter/flutter#191656, which is blocked by the Material code freeze.

Fixes flutter/flutter#82055
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Oct 14, 2026
…bounded (#12586)

Ports flutter/flutter#191656, which is blocked by the Material/Cupertino code freeze in flutter/flutter (see flutter/flutter#188444).

## Original description

`GridTile` placed every child of its `Stack` in a `Positioned` widget, including the tile content. A `Stack` without any non-positioned child sizes itself to the biggest allowed size, which is infinite along the main axis of an unbounded parent such as a horizontally scrolling `ListView`. `RenderStack` then failed its `size.isFinite` assertion.

The tile content is now a non-positioned child of the `Stack` (with `StackFit.passthrough`), wrapped in a small private render object that makes it fill every bounded axis of the incoming constraints and lets it pick its own size only along unbounded axes. As a result, the layout is unchanged whenever the old code did not crash (tight constraints as in `GridView`, and bounded but loose constraints such as `Center` > `ConstrainedBox`), including the reported intrinsic sizes, and the tile shrink-wraps its content along an unbounded axis instead of crashing.

Fixes flutter/flutter#82055

## Test plan

## Pre-Review Checklist

The change uses the repository's pending changelog workflow (`packages/material_ui/pending_changelogs/change_2026_08_25_port191656.yaml`). No public API documentation change is needed.

[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ListView -> GridTile -> footer or header with Column (or Row) throws exceptions

1 participant