Repository: flutter
Issue: Opacity breaks z axis translation
Labels: platform-android,framework,platform-mac,platform-linux,has reproducible steps,P2,found in release: 3.7,found in release: 3.11,team-android,triaged-android

## Steps to Reproduce

<!-- Please include full steps to reproduce so that we can reproduce the problem. -->

1. Run the following app (import `vector_math`)
2. Observe the blue box size
3. Remove the `Opacity` widget
3. Reload

**Expected results:** 
In both runs, the blue box is translated back along the z axis, making it smaller due to perspective

**Actual results:** 
Translation is only applied in the second run, when the widget tree under perspective transform does not contain an `Opacity` widget. This only applies to translation along the z axis. I tested three platforms: Android and Linux are affected, but Web is not.

<details>
<summary>Code sample</summary>

```dart
MaterialApp(
  home: Scaffold(
    body: Transform( // Introduce perspective
      transform: Matrix4.identity()..setEntry(3, 2, 0.01),
      child: Opacity( // Add opacity at any point below the perspective transform
        opacity: .5,
        child: Transform( // Attempt to translate along Z axis
          transform: Matrix4.translation(Vector3(0, 0, 100)),
          child: const SizedBox( // Child widget placeholder
            width: 100,
            height: 100,
            child: ColoredBox(color: Colors.blue),
          ),
        ),
      ),
    ),
  ),
);
```

</details>

<details>
  <summary>Logs</summary>

```
Debug service listening on ws://127.0.0.1:45231/5GWNWi7dVjo=/ws
Syncing files to device Linux...
[  +53 ms] <- reset
[        ] Compiling dart to kernel with 0 updated files
[        ] Processing bundle.
[        ] <- recompile package:testing_project/main.dart 4c6c75ac-403d-4f4e-a5cc-449f3761c0d7
[        ] <- 4c6c75ac-403d-4f4e-a5cc-449f3761c0d7
[   +1 ms] Bundle processing done.
[  +66 ms] Updating files.
[        ] DevFS: Sync finished
[        ] Synced 0.0MB.
[   +1 ms] <- accept
[   +1 ms] Connected to _flutterView/0x564e65afda60.
```

```
Analyzing testing_project...                                            
No issues found! (ran in 1.2s)
```

```
[✓] Flutter (Channel stable, 3.0.1, on Arch Linux 5.15.43-1-lts, locale pl_PL.UTF-8)
    • Flutter version 3.0.1 at /opt/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision fb57da5f94 (2 weeks ago), 2022-05-19 15:50:29 -0700
    • Engine revision caaafc5604
    • Dart version 2.17.1
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /home/sg/Android/Sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /opt/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /usr/bin/google-chrome-stable

[✓] Linux toolchain - develop for Linux desktop
    • clang version 13.0.1
    • cmake version 3.23.2
    • ninja version 1.11.0
    • pkg-config version 1.8.0

[✓] Android Studio (version 2021.2)
    • Android Studio at /opt/android-studio
    • Flutter plugin version 67.1.2
    • Dart plugin version 212.5744
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Community Edition (version 2021.3)
    • IntelliJ at /usr/share/idea
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 213.5744.122

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Arch Linux 5.15.43-1-lts
    • Chrome (web)    • chrome • web-javascript • Google Chrome 102.0.5005.61

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• 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.
-->