Repository: flutter
Issue: ScaleTransition animation with FadeTransition inside doesn't work correctly
Labels: framework,a: animation,has reproducible steps,P3,team-framework,triaged-framework,found in release: 3.19,found in release: 3.20

### Steps to reproduce

run code sample

### Expected results

I expect the scale animation to work.

### Actual results

It works fine only first time. Scale animation some times works randomly.

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
        body: Center(
          child: LogoScale(),
        ),
      ),
    );
  }
}

class LogoScale extends StatefulWidget {
  const LogoScale({super.key});

  @override
  State<LogoScale> createState() => LogoScaleState();
}

class LogoScaleState extends State<LogoScale> {
  bool show = false;

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        ElevatedButton(
          onPressed: (){
            setState(() {
              show = !show;
            });
          },
          child: Text(show ? 'Hide Logo' : 'Show Logo'),
        ),
        Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            AnimationInOut(
                show: show,
                child: const FlutterLogo(size: 100.0,)
            ),
          ],
        ),
      ],
    );
  }
}

class AnimationInOut extends StatefulWidget {
  final bool show;
  final Widget child;

  const AnimationInOut({super.key,
    required this.show,
    required this.child,
  });

  @override
  State<AnimationInOut> createState() => AnimationInOutState();
}

class AnimationInOutState extends State<AnimationInOut> with SingleTickerProviderStateMixin {

  late AnimationController animationController;
  late Animation<double> scaleAnimation;
  late Animation<double> fadeAnimation;

  @override
  void initState() {
    super.initState();
    animationController = AnimationController(vsync: this, duration: const Duration(milliseconds: 300));
    animationController.value = widget.show ? 1.0 : 0.0;
    scaleAnimation = animationController.drive(Tween<double>(begin: 0.0, end: 1.0));
    fadeAnimation = animationController.drive(Tween<double>(begin: 0.0, end: 1.0));
  }

  @override
  void dispose() {
    animationController.dispose();
    super.dispose();
  }

  @override
  void didUpdateWidget(AnimationInOut oldWidget) {
    super.didUpdateWidget(oldWidget);
    if(widget.show){
      animationController.forward();
    }else{
      animationController.reverse();
    }
  }

  @override
  Widget build(BuildContext context) {
    return ScaleTransition(
      scale: scaleAnimation,
      child: FadeTransition(
        opacity: fadeAnimation,
        child: widget.child,
      ),
    );
  }
}
```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]
![Desktop 2024-02-22 - 19-38-02-01](https://github.com/flutter/flutter/assets/138880199/244e794e-f956-47d4-bbcc-de0690eee168)

</details>


### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[√] Flutter (Channel master, 3.20.0-11.0.pre.41, on Microsoft Windows [Version 10.0.19045.4046], locale ru-UA)
    • Flutter version 3.20.0-11.0.pre.41 on channel master at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 3ae71f5c43 (2 days ago), 2024-02-20 11:55:51 -0800
    • Engine revision e16a260265
    • Dart version 3.4.0 (build 3.4.0-157.0.dev)
    • DevTools version 2.33.0-dev.6

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\Sergey\AppData\Local\Android\sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java       
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.5.0)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.5.33414.496
    • Windows 10 SDK version 10.0.22000.0

[√] Android Studio (version 2023.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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 17.0.7+0-b2043.56-10550314)

[√] VS Code (version 1.86.2)
    • VS Code at C:\Users\Sergey\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension can be installed from:
       https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19045.4046]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 121.0.6167.185
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 121.0.2277.128

[√] Network resources
    • All expected network resources are available.

• No issues found!

```

</details>