-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack widget does not clip children wrapped in Align #71625
Comments
@agreaves |
The expected behavior would be that in both the first view and the second view (of my updated code), the blue circle is clipped, because it extends beyond the bounds of the stack. If not, then I would expect them to both not clip the blue circle. The most unintuitive case (to me at least) is the case shown above, where the blue circle is only clipped when there is a Positioned widget in the Stack AND it extends beyond the bounds of the Stack. |
flutter doctor -v
|
The reason this happens is because Stack will only push a clip when its children overflow, in this case the immediate child of the Stack (Align) does not extend beyond it. Perhaps Align should have its own clipping behavior, with an overflow indicator similar to Flex. |
Interesting, so the Align widget doesn't extend beyond the Stack even when its child does? |
Stack clipping is confusing. How do you cut a child item when it crosses the boundaries of the stack? |
Reproduces on stable 3.3 and master 3.7, Notice the Blue circle overflows but does not clip. Code sample in the original post flutter doctor -v (mac)
|
According to this documentation: flutter.dev/go/clip-behavior, Stack is one of the few widgets that will clip it's children by default (as
{Clip clipBehavior = Clip.hardEdge}
is the default). However, even with a simple example (which I've pasted below) this is not the case for children wrapped in Align.Here is an example main.dart that recreates the issue:
code sample
Expected results: The child with
Alignment(1.8, 1)
extends beyond the bounds of the Stack and should be clipped.Actual results: The child with
Alignment(1.8, 1)
is not clipped and is painted beyond the bounds of the Stack.Output of
flutter analyze
:Output of
flutter doctor -v
:Here's a snapshot of the result (it's basically just what I described):
The text was updated successfully, but these errors were encountered: