Repository navigation
Fix GridTile - #191656
Fix GridTile#191656kaluli123123 wants to merge 1 commit into
Conversation
|
This pull request contains changes to Material or Cupertino, which are currently frozen in this repository. Changes should be made in Please refer to #188444 for instructions. |
|
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
5f01433 to
9bbb455
Compare
|
Material is frozen in flutter/flutter (see #188444), so this is ported to flutter/packages instead. Closing this in favor of that PR. |
|
Correcting the link above: ported to flutter/packages#12586. |
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
…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.
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.isFiniteassertion.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-assistbot 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.