Repository: flutter
Issue: IndexedStack displays "hidden" page FAB when returning from a page with a FAB
Labels: framework,f: material design,has reproducible steps,P2,found in release: 2.5,found in release: 2.6,team-design,triaged-design

When there is `FloatingActionButton` in the parent page `IndexedStack`, returning to the parent page will display one of the floating buttons in `IndexedStack`.



https://user-images.githubusercontent.com/76673990/138811815-e1abc3ac-b3d9-4d1c-9218-780666c117a8.mp4

<details>
  <summary>main.dart</summary>

```dart
import 'package:flutter/material.dart';
import 'package:example/page1.dart';
import 'package:example/page2.dart';

Future<void> main(List<String> args) async {
  runApp(const MaterialApp(
    home: HomePage(),
  ));
}

class HomePage extends StatefulWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  int _index = 0;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('AppBar'),
        ),
        drawer: Drawer(
          child: Container(),
        ),
        body: IndexedStack(
          index: _index,
          children: const [
            Page1(),
            Page2(),
          ],
        ),
        bottomNavigationBar: BottomNavigationBar(
          onTap: (int index) => setState(() {
            _index = index;
          }),
          currentIndex: _index,
          items: const [
            BottomNavigationBarItem(
              label: 'Page1',
              icon: Icon(Icons.add),
            ),
            BottomNavigationBarItem(
              label: 'Page2',
              icon: Icon(Icons.add),
            ),
          ],
        ),
      ),
    );
  }
}
```

</details>

<details>
  <summary>page1.dart</summary>

```dart
import 'package:flutter/material.dart';
import 'package:example/test_page.dart';

class Page1 extends StatelessWidget {
  const Page1({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Page1'),
      ),
      body: ElevatedButton(
        onPressed: () => Navigator.push(
          context,
          MaterialPageRoute(builder: (BuildContext context) {
            return const TestPage();
          }),
        ),
        child: const Text('TestPage'),
      ),
    );
  }
}
```

</details>

<details>
  <summary>page2.dart</summary>

```dart
import 'package:flutter/material.dart';

class Page2 extends StatelessWidget {
  const Page2({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('TestPage'),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {},
        child: const Icon(Icons.search_outlined),
      ),
    );
  }
}
```

</details>

<details>
  <summary>test_page.dart</summary>

```dart
import 'package:flutter/material.dart';

class TestPage extends StatelessWidget {
  const TestPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('TestPage'),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {},
        child: const Icon(Icons.favorite_outline_sharp),
      ),
    );
  }
}

```

</details>

<details>
  <summary>flutter doctor -v</summary>

```console
[✓] Flutter (Channel stable, 2.5.3, on Microsoft Windows [Version 10.0.19044.1288], locale zh-CN)
    • Flutter version 2.5.3 at M:\SDK\Flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18116933e7 (10 days ago), 2021-10-15 10:46:35 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at M:\SDK\Android
    • Platform android-31, build-tools 31.0.0
    • ANDROID_SDK_ROOT = M:\SDK\Android
    • Java binary at: M:\IDE\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at M:\Software\Google\Chrome\Application\chrome.exe

[✓] Android Studio (version 2021.1)
    • Android Studio at M:\IDE\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 11.0.11+9-b60-7590822)

[✓] IntelliJ IDEA Ultimate Edition (version 2021.2)
    • IntelliJ at M:\IDE\IDEA
    • Flutter plugin version 61.2.4
    • Dart plugin version 212.5486

[✓] Connected device (3 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86    • Android 11 (API 30) (emulator)
    • Chrome (web)                       • chrome        • web-javascript • Google Chrome 94.0.4606.81
    • Edge (web)                         • edge          • web-javascript • Microsoft Edge 94.0.992.47 (unsupported)

• No issues found!
```
</details>