Repository: flutter
Issue: flutter_goldens generate different files everytime 
Labels: a: tests,framework,will affect goldens,has reproducible steps,P2,found in release: 2.5,found in release: 2.6,team-framework,triaged-framework

Hello, after migrating to flutter 2.5.0 our goldens failed as we noticed that there was a change in the shadows. We then  had to recreate all of our goldens. After runing the tests with the new goldens, we still received a 0.0% diff in one of our screens.

Looking further it seems that for that particular widget the shadows are created differently each time, so a test can pass on one run and fail on the other, it's being totally random so far.

We extracted the code causing the issue and created a [test repo](https://github.com/diegog-sf/goldendemo).


## Steps to Reproduce

<!-- Please include full steps to reproduce so that we can reproduce the problem. -->

1. With flutter 2.5.x Execute `flutter test` on the provided example repo, see how some test will fail
2.  Execute `flutter test --update-goldens` to create a fresh set of images
3. Execute `flutter test` again, and see how some test will still fail

## Findings

1. We have a function called `setupSize` to setup the size of the golden image. If we remove it's contents, the issue is fixed.
2. We have this code 
```dart
Scaffold(
      body: Stack(
        children: [
       // other children removed for demo
          Positioned(
            top: _defaultFloatingTopPosition - _offset,
            right: 0,
            left: 0,
            child: IgnorePointer(....
        )
)
```
if we remove the `Stack(children[Positioned( ` the issue is fixed.
```dart
Scaffold(
      body: IgnorePointer(...
```





**Expected results:** 
Golden tests should not fail after updating images

**Actual results:** 
Golden tests fail randomly

<details>
<summary>Code sample</summary>

https://github.com/diegog-sf/goldendemo


</details>

<details>
  <summary>Logs</summary>

<!--
      Run your application with `flutter run --verbose` and attach all the
      log output below between the lines with the backticks. If there is an
      exception, please see if the error message includes enough information
      to explain how to solve the issue.
-->

flutter test
```
00:05 +4 -2: Home golden tests group2 Test7                                                                                                                                                                                      
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following assertion was thrown while running async test code:
Golden "goldens/Test7.png": Pixel test failed, 0.00% diff detected.
Failure feedback can be found at /Users/diego/workspaces/goldendemo/test/failures

When the exception was thrown, this was the stack:
#0      LocalFileComparator.compare (package:flutter_test/src/_goldens_io.dart:101:7)
<asynchronous suspension>
<asynchronous suspension>
(elided one frame from package:stack_trace)
```

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->

```
Analyzing goldendemo...                                                 
No issues found! (ran in 1.1s)
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
[✓] Flutter (Channel stable, 2.5.3, on macOS 12.0.1 21A559 darwin-x64, locale en-MX)
    • Flutter version 2.5.3 at /Users/diego/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18116933e7 (12 days ago), 2021-10-15 10:46:35 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/diego/Library/Android/sdk
    • Platform android-31, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 13.1, Build version 13A1030d
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[✓] VS Code (version 1.61.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.27.0

[✓] Connected device (2 available)
    • iPhone 13 Pro (mobile) • 4E63E183-DACE-4D21-A433-55DDA5A59F7E • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator)
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 95.0.4638.54

• No issues found!
```

</details>


<!--
      Consider also attaching screenshots and/or videos to better
      illustrate the issue.

      You can upload them directly on GitHub.
      Beware that video file size is limited to 10MB.
-->