Repository: flutter
Issue: Navigator can't be used inside scrollable content.
Labels: framework,f: routes,customer: crowd,has reproducible steps,P2,found in release: 3.10,found in release: 3.12,team-framework,triaged-framework

### 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

**Context**

1. Your app has a main screen with a bottom bar to provide access to several pages.
2. You wish to provide said bottom bar, and your top bar as a shell around these pages, so they won't animate when the user navigates around them.
3. You use a nested `Navigator` to provide said experience. Here we'll use **go_router** to demonstrate it.
4. The `Navigator` won't allow it, since it cannot be placed in unbounded scenarios and constraining it will result in losing other capabilities, like floating your top bar.

**Steps to reproduce**

1. Create the screens:
```
class MainScreen extends StatelessWidget {
  final Widget child;

  const MainScreen({
    Key? key,
    required this.child,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: CustomScrollView(
        slivers: [
          const SliverAppBar(
            title: Text("Title"),
            floating: true,
          ),
          /* Using another type of sliver, like SliverToBoxAdapter, will result in the Navigator complaining of infinite constraints */
          SliverFillRemaining(
            child: child,
          ),
        ],
      ),
      bottomNavigationBar: BottomNavigationBar(
        items: const [
          BottomNavigationBarItem(icon: Icon(Icons.one_k), label: 'One'),
          BottomNavigationBarItem(icon: Icon(Icons.two_k), label: 'Two'),
          BottomNavigationBarItem(icon: Icon(Icons.three_k), label: 'Three'),
        ],
      ),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    /* Notice how the floating disappears from the SliverAppBar, and removing the SingleChildScrollView causes an overflow */
    return SingleChildScrollView(
       child: Column(
        children: [
          for (int i = 0; i < 50; i++)
            SizedBox(
              height: 50,
              width: double.infinity,
              child: Center(
                child: Text(i.toString()),
              ),
            ),
        ],
      ),
    ); 
  }
}

class APage extends StatelessWidget {
  const APage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const Placeholder();
  }
}
```
2. Create the routes:
```
final _router = GoRouter(
  routes: [
    ShellRoute(
      builder: (_, __, navigator) => MainScreen(child: navigator),
      routes: [
        GoRoute(
          path: '/',
          builder: (_, __) => const HomePage(),
          routes: [
            GoRoute(
              path: 'a',
              builder: (_, __) => const APage(),
            ),
          ],
        ),
      ],
    ),
  ],
);
```

**Explanation**

Currently, `Navigator` requires finite constraints, meaning it cannot be adequately used inside scrolling widgets like `CustomScrollView`, since you may or may not know its child's height.

### Expected results

`Navigator` should be able to be used inside scrolling widgets without providing finite constraints.

### Actual results

1. You're forced to provide finite constraints. (why I used `SliverFillRemaining`).
2. The content inside the `Navigator` either overflows or it scrolls (if you add another `ScrollView` for it), but then loses its relationship with the outer `CustomScrollView`, causing in this example, the SliverAppBar to lose its floating capabilities.

### Code sample

<details><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

void main() {
  runApp(const MyApp());
}

// GoRouter configuration
final _router = GoRouter(
  routes: [
    ShellRoute(
      builder: (context, state, navigator) => MainScreen(child: navigator),
      routes: [
        GoRoute(
          path: '/',
          builder: (_, __) => const HomePage(),
          routes: [
            GoRoute(
              path: 'a',
              builder: (_, __) => const APage(),
            ),
            GoRoute(
              path: 'b',
              builder: (_, __) => const BPage(),
            ),
          ],
        ),
      ],
    ),
  ],
);

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      routerConfig: _router,
    );
  }
}

class MainScreen extends StatelessWidget {
  final Widget child;

  const MainScreen({
    Key? key,
    required this.child,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: CustomScrollView(
        slivers: [
          const SliverAppBar(
            title: Text("Title"),
            floating: true,
          ),
          /*SliverToBoxAdapter(
            child: child,
          ),*/
          /* Uncomment SliverFillRemaining and comment SliverToBoxAdapter, to
           * make it work but overflow */
          SliverFillRemaining(
            child: child,
          )
        ],
      ),
      bottomNavigationBar: BottomNavigationBar(
        items: const [
          BottomNavigationBarItem(icon: Icon(Icons.one_k), label: 'One'),
          BottomNavigationBarItem(icon: Icon(Icons.two_k), label: 'Two'),
          BottomNavigationBarItem(icon: Icon(Icons.three_k), label: 'Three'),
        ],
      ),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      child: Column(
        children: [
          for (int i = 0; i < 50; i++)
            SizedBox(
              height: 50,
              width: double.infinity,
              child: Center(
                child: Text(i.toString()),
              ),
            ),
        ],
      ),
    );
  }
}

class APage extends StatelessWidget {
  const APage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const Placeholder();
  }
}

class BPage extends StatelessWidget {
  const BPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const Placeholder();
  }
}
```

</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.0, on macOS 13.4.1 22F82 darwin-arm64, locale en-CA)
    • Flutter version 3.10.0 on channel stable at /Users/rodxander/Library/Flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 84a1e904f4 (7 weeks ago), 2023-05-09 07:41:44 -0700
    • Engine revision d44b5a94c9
    • Dart version 3.0.0
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/rodxander/Library/Android/sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • 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.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
    • 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.15+0-b2043.56-8887301)

[✓] VS Code (version 1.79.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.66.0

[✓] Connected device (4 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554                        • android-arm64  • Android 13 (API 33) (emulator)
    • iPhone 14 Pro Max (mobile)  • 2E746A3B-7B63-4C7B-8240-EB9BF9668FE5 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
    • macOS (desktop)             • macos                                • darwin-arm64   • macOS 13.4.1 22F82 darwin-arm64
    • Chrome (web)                • chrome                               • web-javascript • Google Chrome 114.0.5735.133

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>