Skip to content

Document overlay sizing constraints#186880

Open
mvincentong wants to merge 1 commit into
flutter:masterfrom
mvincentong:docs-composited-transform-follower-sizing
Open

Document overlay sizing constraints#186880
mvincentong wants to merge 1 commit into
flutter:masterfrom
mvincentong:docs-composited-transform-follower-sizing

Conversation

@mvincentong
Copy link
Copy Markdown
Contributor

@mvincentong mvincentong commented May 21, 2026

Fixes #48052.

Issue: The reported behavior comes from Overlay layout, not from CompositedTransformFollower: non-positioned overlay entries are laid out with tight constraints matching the overlay's size, so a fixed-size visual child needs to be positioned or sized inside the entry.

Fix:

  • Moves the guidance to the Overlay class docs.
  • Documents how Overlay chooses its own size for finite constraints, infinite constraints, and OverlayEntry.canSizeOverlay.
  • Documents that non-positioned overlay entries receive tight overlay-sized constraints, and points readers to sizing/positioning widgets such as Positioned and Align.

Tests:

  • ./bin/dart format --output=none --set-exit-if-changed packages/flutter/lib/src/widgets/basic.dart packages/flutter/lib/src/widgets/overlay.dart
  • ./bin/flutter analyze packages/flutter/lib/src/widgets/basic.dart packages/flutter/lib/src/widgets/overlay.dart
  • git diff --check

Risk: Documentation-only. This updates the location and wording of the guidance to match the underlying layout behavior.

@github-actions github-actions Bot added the framework flutter/packages/flutter repository. See also f: labels. label May 21, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds documentation to clarify how CompositedTransformFollower handles layout constraints and the compositing phase. Feedback suggests improving technical precision regarding the timing of the transform, using brackets for class links per the style guide, and adjusting the recommended wrapping strategy for better hit testing.

Comment thread packages/flutter/lib/src/widgets/basic.dart Outdated
@mvincentong mvincentong force-pushed the docs-composited-transform-follower-sizing branch from 50e8105 to 42bb1bb Compare May 21, 2026 13:36
@mvincentong
Copy link
Copy Markdown
Contributor Author

Updated the docs wording in head 42bb1bb to make the layout/compositing distinction more precise, link Overlay, and recommend loosening constraints around the follower itself. Reran format, targeted analyze, and git diff --check.

@Piinks Piinks requested review from QuncCccccc and victorsanni May 26, 2026 22:30
QuncCccccc
QuncCccccc previously approved these changes May 27, 2026
Copy link
Copy Markdown
Contributor

@QuncCccccc QuncCccccc left a comment

Choose a reason for hiding this comment

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

LGTM. The doc makes sense to me, but I'm not familiar with CompositedTransformFollower so would like to wait @chunhtai or @victorsanni for another round of review:)

Thanks for your contribution!

@chunhtai chunhtai self-requested a review May 27, 2026 15:47
Comment thread packages/flutter/lib/src/widgets/basic.dart Outdated
@chunhtai chunhtai requested a review from LongCatIsLooong May 27, 2026 16:45
@LongCatIsLooong
Copy link
Copy Markdown
Contributor

I looked at #48052 and it doesn't seem to have to do with CompositedTransformFollower, it's just misunderstanding of how Constraints work. I don't think this the right place for the documentation, since it's the parent that's enforcing the size.

@LongCatIsLooong
Copy link
Copy Markdown
Contributor

I think we should probably add documentation to the Overaly class to explain how it sizes itself (also the class documentation does not seem to mention size-determining child) and what kind of constraints it gives to non-Positioned children.

@mvincentong mvincentong force-pushed the docs-composited-transform-follower-sizing branch from 42bb1bb to 9c3a503 Compare May 29, 2026 13:13
@mvincentong mvincentong changed the title Document follower overlay sizing constraints Document overlay sizing constraints May 29, 2026
@mvincentong
Copy link
Copy Markdown
Contributor Author

Moved this guidance to Overlay in 9c3a503, matching the review feedback that the issue is Overlay sizing/constraints rather than CompositedTransformFollower behavior. The PR now documents Overlay sizing, canSizeOverlay, and the tight constraints used for non-positioned overlay entries. Verification rerun: formatter, targeted analyze, and git diff --check pass.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CompositedTransformFollower expands infinitely in some cases

4 participants