Repository: flutter
Issue: ShellRoute issues with child size in `Column`s, `SingleChildscrollView`s, etc.
Labels: 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 package issues](https://github.com/flutter/flutter/issues?q=is%3Aopen+is%3Aissue+label%3Apackage)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### What package does this bug report belong to?

go_router

### What target platforms are you seeing this bug on?

Web, macOS

### Have you already upgraded your packages?

Yes

### Dependency versions

<details><summary>pubspec.lock</summary>

```lock
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
  async:
    dependency: transitive
    description:
      name: async
      sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
      url: "https://pub.dev"
    source: hosted
    version: "2.11.0"
  boolean_selector:
    dependency: transitive
    description:
      name: boolean_selector
      sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
      url: "https://pub.dev"
    source: hosted
    version: "2.1.1"
  characters:
    dependency: transitive
    description:
      name: characters
      sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
      url: "https://pub.dev"
    source: hosted
    version: "1.3.0"
  clock:
    dependency: transitive
    description:
      name: clock
      sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
      url: "https://pub.dev"
    source: hosted
    version: "1.1.1"
  collection:
    dependency: transitive
    description:
      name: collection
      sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
      url: "https://pub.dev"
    source: hosted
    version: "1.17.1"
  cupertino_icons:
    dependency: "direct main"
    description:
      name: cupertino_icons
      sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be
      url: "https://pub.dev"
    source: hosted
    version: "1.0.5"
  fake_async:
    dependency: transitive
    description:
      name: fake_async
      sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
      url: "https://pub.dev"
    source: hosted
    version: "1.3.1"
  flutter:
    dependency: "direct main"
    description: flutter
    source: sdk
    version: "0.0.0"
  flutter_lints:
    dependency: "direct dev"
    description:
      name: flutter_lints
      sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4"
      url: "https://pub.dev"
    source: hosted
    version: "2.0.2"
  flutter_test:
    dependency: "direct dev"
    description: flutter
    source: sdk
    version: "0.0.0"
  flutter_web_plugins:
    dependency: transitive
    description: flutter
    source: sdk
    version: "0.0.0"
  go_router:
    dependency: "direct main"
    description:
      name: go_router
      sha256: b3cadd2cd59a4103fd5f6bc572ca75111264698784e927aa471921c3477d5475
      url: "https://pub.dev"
    source: hosted
    version: "10.0.0"
  js:
    dependency: transitive
    description:
      name: js
      sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
      url: "https://pub.dev"
    source: hosted
    version: "0.6.7"
  lints:
    dependency: transitive
    description:
      name: lints
      sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
      url: "https://pub.dev"
    source: hosted
    version: "2.1.1"
  logging:
    dependency: transitive
    description:
      name: logging
      sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
      url: "https://pub.dev"
    source: hosted
    version: "1.2.0"
  matcher:
    dependency: transitive
    description:
      name: matcher
      sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
      url: "https://pub.dev"
    source: hosted
    version: "0.12.15"
  material_color_utilities:
    dependency: transitive
    description:
      name: material_color_utilities
      sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
      url: "https://pub.dev"
    source: hosted
    version: "0.2.0"
  meta:
    dependency: transitive
    description:
      name: meta
      sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
      url: "https://pub.dev"
    source: hosted
    version: "1.9.1"
  path:
    dependency: transitive
    description:
      name: path
      sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
      url: "https://pub.dev"
    source: hosted
    version: "1.8.3"
  sky_engine:
    dependency: transitive
    description: flutter
    source: sdk
    version: "0.0.99"
  source_span:
    dependency: transitive
    description:
      name: source_span
      sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
      url: "https://pub.dev"
    source: hosted
    version: "1.9.1"
  stack_trace:
    dependency: transitive
    description:
      name: stack_trace
      sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
      url: "https://pub.dev"
    source: hosted
    version: "1.11.0"
  stream_channel:
    dependency: transitive
    description:
      name: stream_channel
      sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
      url: "https://pub.dev"
    source: hosted
    version: "2.1.1"
  string_scanner:
    dependency: transitive
    description:
      name: string_scanner
      sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
      url: "https://pub.dev"
    source: hosted
    version: "1.2.0"
  term_glyph:
    dependency: transitive
    description:
      name: term_glyph
      sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
      url: "https://pub.dev"
    source: hosted
    version: "1.2.1"
  test_api:
    dependency: transitive
    description:
      name: test_api
      sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
      url: "https://pub.dev"
    source: hosted
    version: "0.5.1"
  vector_math:
    dependency: transitive
    description:
      name: vector_math
      sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
      url: "https://pub.dev"
    source: hosted
    version: "2.1.4"
sdks:
  dart: ">=3.0.6 <4.0.0"
  flutter: ">=3.3.0"
```

</details>


### Steps to reproduce

1. Create a minimal app with a `GoRouter` and a `ShellRoute` with a shell widget and widget that will contain the child and does not define finite height constraints, e.g. `SingleChildScrollView`
2. Pass child into the ShellRoute widget and display as child
3. Open the app

### Expected results

Scrollable view with the `GoRoute`'s built widget as child of the ShellRoute.
Specifically to the example, the Lorem Ipsum text should be scrollable with a title above it that also scrolls. Changing the route should only change the content below the title as that is the shell.

### Actual results

App has rendering issues, does not show any content at all. Shows errors in log hinting at constraints not being correctly determined.

In the example below, replacing the `Material`'s child `child` that is passed to the `ShellRoute`'s builder with the exact content of the `GoRoute`'s MyHomePage widget, i.e.:
<details><summary>Modified part of code sample from below</summary>

```dart
final router = GoRouter(routes: [
  ShellRoute(
      builder: (context, state, child) => SingleChildScrollView(
            child: Column(
              children: [
                const Material(
                  child: Center(child: Text('Title')),
                ),
                Container(
                  color: Colors.white,
                  child: Material(
                    child: const Text('''
  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Tempus iaculis urna id volutpat lacus. Et ultrices neque ornare aenean euismod. Nunc aliquet bibendum enim facilisis gravida neque. Sed nisi lacus sed viverra tellus in hac habitasse. Laoreet id donec ultrices tincidunt arcu. Euismod elementum nisi quis eleifend quam adipiscing vitae. A diam sollicitudin tempor id eu nisl nunc mi ipsum. Amet nulla facilisi morbi tempus iaculis urna id volutpat. Mattis aliquam faucibus purus in massa tempor nec feugiat nisl. Pellentesque sit amet porttitor eget dolor morbi non. Lectus quam id leo in vitae turpis massa. Non tellus orci ac auctor augue mauris augue neque gravida.
  
  Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Aliquet nibh praesent tristique magna sit amet purus. Velit euismod in pellentesque massa placerat. Felis eget nunc lobortis mattis aliquam faucibus purus in massa. Velit scelerisque in dictum non consectetur a erat nam. Vestibulum mattis ullamcorper velit sed ullamcorper morbi tincidunt ornare. Lorem sed risus ultricies tristique. Nisl pretium fusce id velit. Neque ornare aenean euismod elementum nisi quis eleifend. Congue eu consequat ac felis. Tortor aliquam nulla facilisi cras fermentum odio eu. Nisl pretium fusce id velit ut tortor. Pellentesque pulvinar pellentesque habitant morbi tristique senectus et. Porttitor eget dolor morbi non arcu. At imperdiet dui accumsan sit amet nulla facilisi morbi. Porta nibh venenatis cras sed felis eget velit aliquet.
  
  Pellentesque diam volutpat commodo sed egestas. Rhoncus urna neque viverra justo nec. A arcu cursus vitae congue mauris rhoncus. Risus in hendrerit gravida rutrum quisque non tellus orci. Dictum at tempor commodo ullamcorper a. Risus pretium quam vulputate dignissim suspendisse. Laoreet id donec ultrices tincidunt arcu non sodales neque. Enim lobortis scelerisque fermentum dui faucibus. Elementum facilisis leo vel fringilla est ullamcorper eget. Facilisis leo vel fringilla est ullamcorper eget nulla facilisi. Vitae auctor eu augue ut lectus. Egestas sed tempus urna et pharetra pharetra massa massa. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Rhoncus urna neque viverra justo nec. Varius duis at consectetur lorem donec massa sapien faucibus et. Nam at lectus urna duis. Mauris pharetra et ultrices neque.
  
  In ornare quam viverra orci. Vel elit scelerisque mauris pellentesque pulvinar pellentesque habitant morbi tristique. Nisl rhoncus mattis rhoncus urna neque viverra justo. Eu ultrices vitae auctor eu augue ut lectus arcu. Viverra adipiscing at in tellus integer feugiat scelerisque. Pellentesque sit amet porttitor eget dolor morbi non. Nec feugiat in fermentum posuere. Turpis egestas sed tempus urna et. Tortor dignissim convallis aenean et tortor at risus viverra adipiscing. Cursus eget nunc scelerisque viverra mauris in aliquam sem.
  
  Tincidunt vitae semper quis lectus nulla at volutpat diam. Auctor elit sed vulputate mi sit amet mauris commodo quis. Ornare arcu odio ut sem nulla. Dolor sit amet consectetur adipiscing elit duis tristique sollicitudin nibh. Curabitur vitae nunc sed velit. Aliquet nec ullamcorper sit amet risus nullam eget felis eget. Quisque sagittis purus sit amet volutpat consequat mauris. Eget nullam non nisi est. Odio morbi quis commodo odio aenean sed adipiscing. Cursus metus aliquam eleifend mi in nulla posuere sollicitudin. Urna porttitor rhoncus dolor purus non enim praesent elementum. Commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Et ultrices neque ornare aenean euismod. Dignissim convallis aenean et tortor. Sed adipiscing diam donec adipiscing tristique risus nec feugiat in. Sit amet porttitor eget dolor morbi. Id leo in vitae turpis massa sed elementum tempus egestas.
      '''),
                  ),
                )
              ],
            ),
          ),
      routes: [
        GoRoute(
          path: '/',
          builder: (context, state) => const MyHomePage(),
        ),
      ])
]);
```

</details>

fixes the issue but defeats the purpose of the ShellRoute.

### 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());
}

final router = GoRouter(routes: [
  ShellRoute(
      builder: (context, state, child) => SingleChildScrollView(
            child: Column(
              children: [
                const Material(
                  child: Center(child: Text('Title')),
                ),
                Container(
                  color: Colors.white,
                  child: Material(
                    child: child,
                  ),
                )
              ],
            ),
          ),
      routes: [
        GoRoute(
          path: '/',
          builder: (context, state) => const MyHomePage(),
        ),
      ])
]);

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      theme: ThemeData.from(
          colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue)),
      routerConfig: router,
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return const Text('''
  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Tempus iaculis urna id volutpat lacus. Et ultrices neque ornare aenean euismod. Nunc aliquet bibendum enim facilisis gravida neque. Sed nisi lacus sed viverra tellus in hac habitasse. Laoreet id donec ultrices tincidunt arcu. Euismod elementum nisi quis eleifend quam adipiscing vitae. A diam sollicitudin tempor id eu nisl nunc mi ipsum. Amet nulla facilisi morbi tempus iaculis urna id volutpat. Mattis aliquam faucibus purus in massa tempor nec feugiat nisl. Pellentesque sit amet porttitor eget dolor morbi non. Lectus quam id leo in vitae turpis massa. Non tellus orci ac auctor augue mauris augue neque gravida.
  
  Hac habitasse platea dictumst quisque sagittis purus sit amet volutpat. Aliquet nibh praesent tristique magna sit amet purus. Velit euismod in pellentesque massa placerat. Felis eget nunc lobortis mattis aliquam faucibus purus in massa. Velit scelerisque in dictum non consectetur a erat nam. Vestibulum mattis ullamcorper velit sed ullamcorper morbi tincidunt ornare. Lorem sed risus ultricies tristique. Nisl pretium fusce id velit. Neque ornare aenean euismod elementum nisi quis eleifend. Congue eu consequat ac felis. Tortor aliquam nulla facilisi cras fermentum odio eu. Nisl pretium fusce id velit ut tortor. Pellentesque pulvinar pellentesque habitant morbi tristique senectus et. Porttitor eget dolor morbi non arcu. At imperdiet dui accumsan sit amet nulla facilisi morbi. Porta nibh venenatis cras sed felis eget velit aliquet.
  
  Pellentesque diam volutpat commodo sed egestas. Rhoncus urna neque viverra justo nec. A arcu cursus vitae congue mauris rhoncus. Risus in hendrerit gravida rutrum quisque non tellus orci. Dictum at tempor commodo ullamcorper a. Risus pretium quam vulputate dignissim suspendisse. Laoreet id donec ultrices tincidunt arcu non sodales neque. Enim lobortis scelerisque fermentum dui faucibus. Elementum facilisis leo vel fringilla est ullamcorper eget. Facilisis leo vel fringilla est ullamcorper eget nulla facilisi. Vitae auctor eu augue ut lectus. Egestas sed tempus urna et pharetra pharetra massa massa. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Rhoncus urna neque viverra justo nec. Varius duis at consectetur lorem donec massa sapien faucibus et. Nam at lectus urna duis. Mauris pharetra et ultrices neque.
  
  In ornare quam viverra orci. Vel elit scelerisque mauris pellentesque pulvinar pellentesque habitant morbi tristique. Nisl rhoncus mattis rhoncus urna neque viverra justo. Eu ultrices vitae auctor eu augue ut lectus arcu. Viverra adipiscing at in tellus integer feugiat scelerisque. Pellentesque sit amet porttitor eget dolor morbi non. Nec feugiat in fermentum posuere. Turpis egestas sed tempus urna et. Tortor dignissim convallis aenean et tortor at risus viverra adipiscing. Cursus eget nunc scelerisque viverra mauris in aliquam sem.
  
  Tincidunt vitae semper quis lectus nulla at volutpat diam. Auctor elit sed vulputate mi sit amet mauris commodo quis. Ornare arcu odio ut sem nulla. Dolor sit amet consectetur adipiscing elit duis tristique sollicitudin nibh. Curabitur vitae nunc sed velit. Aliquet nec ullamcorper sit amet risus nullam eget felis eget. Quisque sagittis purus sit amet volutpat consequat mauris. Eget nullam non nisi est. Odio morbi quis commodo odio aenean sed adipiscing. Cursus metus aliquam eleifend mi in nulla posuere sollicitudin. Urna porttitor rhoncus dolor purus non enim praesent elementum. Commodo sed egestas egestas fringilla phasellus faucibus scelerisque. Et ultrices neque ornare aenean euismod. Dignissim convallis aenean et tortor. Sed adipiscing diam donec adipiscing tristique risus nec feugiat in. Sit amet porttitor eget dolor morbi. Id leo in vitae turpis massa sed elementum tempus egestas.
      ''');
  }
}
```

</details>


### Screenshots or Videos

<details>
<summary>Screenshots / Video demonstration</summary>

[Video](https://drive.google.com/file/d/1z66b5sr0jhTbttabvAc0d1pwEhoGlnKE/view)

</details>


### Logs

<details><summary>Logs</summary>

[Part of error log](https://pastebin.com/UVnF6nGd)

</details>


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.6, on macOS 13.5 22G74 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.3)
[✓] VS Code (version 1.81.1)
[✓] Connected device (2 available)
[✓] Network resources

• No issues found!

```

</details>