Repository: flutter
Issue: extendBodyBehindAppBar breaks ScrollController attachment
Labels: framework,f: material design,f: scrolling,d: stackoverflow,has reproducible steps,P3,found in release: 3.3,found in release: 3.6,team-design,triaged-design

I wanted to animate app bar depending on scroll position (with an image behind it, that's the whole point of animation):

That's how it looks like currently (with the snippet below, but after rebuilding the widget tree with setState):
![output](https://user-images.githubusercontent.com/15970653/204342148-e179f13f-3d75-487c-aa4a-96cf622011d9.gif)

After adding `extendBodyBehindAppBar: true` to the code, on initial load (before hot reload) the screen looks like this (screenshot from my example below):
![image](https://user-images.githubusercontent.com/15970653/204342510-3f7726c6-9ad6-495c-9343-6d6784b2345e.png)

Relevant snippet:
```dart
class _TestScreenState extends State<TestScreen> {
  final controller = ScrollController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      extendBodyBehindAppBar: true,           // remove this line to make it work
      appBar: PreferredSize(
        preferredSize: Size.fromHeight(56),
        child: AnimatedBuilder(
          animation: controller,
          builder: (_, __) => AppBar(
            title: Text(controller.offset.toString()),
          ),
        ),
      ),
      body: ListView.builder(
        controller: controller,
        itemBuilder: (context, index) => SizedBox(
          height: 32,
          child: Text(index.toString()),
        ),
      ),
    );
  }
}
```

Stacktrace:
```
════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building AnimatedBuilder(animation: ScrollController#2b8e3(no clients), dirty, state: _AnimatedState#548ce):
ScrollController not attached to any scroll views.
'package:flutter/src/widgets/scroll_controller.dart':
package:flutter/…/widgets/scroll_controller.dart:1
Failed assertion: line 107 pos 12: '_positions.isNotEmpty'

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

The relevant error-causing widget was
AnimatedBuilder
package:playground/main.dart:30
When the exception was thrown, this was the stack
#2      ScrollController.position
package:flutter/…/widgets/scroll_controller.dart:107
#3      ScrollController.offset
package:flutter/…/widgets/scroll_controller.dart:115
#4      _TestScreenState.build.<anonymous closure>
package:playground/main.dart:33
```

Basically adding `extendBodyBehindAppBar: true` somehow causes the ScrollController to not get attached.

Reproducible example:
https://gist.github.com/eEQK/82c113b4c5471dd33961f8c07b750015
Reproducible example in dartpad:
https://dartpad.dev/?id=82c113b4c5471dd33961f8c07b750015

In order to reproduce, copy the code from the gist and run it in dartpad.dev or run it as an application

I can consistently reproduce it on:
 * dartpad.dev with both latest stable and master channel
 * Android 12 emulator
 * iOS 15.5 emulator
 
 ```
 $ flutter --version
Flutter 3.3.9 • channel stable • https://github.com/flutter/flutter.git
Framework • revision b8f7f1f986 (6 days ago) • 2022-11-23 06:43:51 +0900
Engine • revision 8f2221fbef
Tools • Dart 2.18.5 • DevTools 2.15.0
```