Repository: flutter
Issue: [go_router] iOS ONLY - scroll to top not working when using StatefulNavigationShell
Labels: platform-ios,package,has reproducible steps,P2,p: go_router,found in release: 3.10,team-go_router,triaged-go_router,found in release: 3.13

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

1. Set up GoRouter with StatefulShellRoute.indexedStack
2. Use the navigationShell to build the navigation layout
3. Tap status bar and scroll to top does not work

### Expected results

Tapping the status bar should scroll to the top. For some reason using the navigationShell breaks this functionality.

### Actual results

Scroll to top is not working.

### Code sample

<details><summary>Router Setup</summary>

```dart
final _rootNavigatorKey = GlobalKey<NavigatorState>();
final _shellNavigatorHomeKey =
    GlobalKey<NavigatorState>(debugLabel: 'shellHome');

final GoRouter router = GoRouter(
  initialLocation: "/home",
  navigatorKey: _rootNavigatorKey,
  routes: <RouteBase>[
    StatefulShellRoute.indexedStack(
      parentNavigatorKey: _rootNavigatorKey,
      builder: (context, state, navigationShell) {
        return Gatekeeper(navigationShell: navigationShell);
      },
      branches: [
        StatefulShellBranch(
          navigatorKey: _shellNavigatorHomeKey,
          routes: [
            GoRoute(
              path: '/home',
              pageBuilder: (context, state) => const NoTransitionPage(
                child: HomeScreen(),
              ),
              routes: [
                // child route
              ],
            ),
          ],
        ),
      ],
    ),
  ),
);
```

</details>

<details><summary>Using body: navigationShell breaks the scroll to top functionality</summary>

```dart
class Gatekeeper extends HookConsumerWidget {
  final StatefulNavigationShell navigationShell;

  const Gatekeeper({
    Key? key,
    required this.navigationShell,
  }) : super(key: key ?? const ValueKey('ScaffoldWithNestedNavigation'));

  void goBranch(int index) {
    navigationShell.goBranch(
        index,
        initialLocation: index == navigationShell.currentIndex,
      );
    }

  Widget build(context, ref) {
    return Scaffold(
      key: key,
      body: navigationShell, // <----- this is what causes the issue. Replace this with anything else, like a ListView with 50 elements, and tapping status bar to scroll top should work
      bottomNavigationBar: BottomNavigationBar(
        showSelectedLabels: false,
        showUnselectedLabels: false,
        selectedFontSize: 12,
        unselectedFontSize: 12,
        iconSize: 25,
        currentIndex: navigationShell.currentIndex,
        onTap: goBranch,
        items: [
          const BottomNavigationBarItem(
            icon: Icon(MaterialCommunityIcons.calendar_check_outline),
            label: "Home",
          ),
        ],
      ),
    );
  }
}
```
</details>


<details><summary>Home example</summary>

```dart
class HomeScreen extends StatelessWidget {
  @override
  Widget build(context) {
    final items = List<String>.generate(50, (i) => 'Item $i');
    return Scaffold(
      body: ListView.builder(
          itemCount: items.length,
          prototypeItem: ListTile(
            title: Text(items.first),
          ),
          itemBuilder: (context, index) {
            return ListTile(
              title: Text(items[index]),
            );
          },
        ),
    );
  }
}
```
</details>



### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]

</details>


### Logs

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


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.10.6, on macOS 13.4.1 22F770820d darwin-x64, locale en-US)
    • Flutter version 3.10.6 on channel stable at /usr/local/Caskroom/flutter/2.2.3/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f468f3366c (3 weeks ago), 2023-07-12 15:19:05 -0700
    • Engine revision cdbeda788a
    • Dart version 3.0.6
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/lkp-k/Library/Android/sdk
    • Platform android-33, build-tools 32.1.0-rc1
    • ANDROID_HOME = /Users/lkp-k/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.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.12+0-b1504.28-7817840)

[✓] VS Code (version 1.80.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.70.0

[✓] Connected device (3 available)
    • DARK MODE (mobile) • 00000000-000000000000000 • ios            • iOS 16.5.1 20F75
    • macOS (desktop)    • macos                     • darwin-x64     • macOS 13.4.1 22F770820d
      darwin-x64
    • Chrome (web)       • chrome                    • web-javascript • Google Chrome 115.0.5790.114

[✓] Network resources
    • All expected network resources are available.

```

</details>