Repository: flutter
Issue: SliverAppBar doesn't work as expected with CustomScrollView using center property
Labels: framework,f: scrolling,d: api docs,d: stackoverflow,has reproducible steps,P2,found in release: 3.7,found in release: 3.9,team-framework,triaged-framework

Here's the sample code to reproduce the bug. The floating SliverAppBar should appear when we scroll up but this is not the case when center property is used with CustomScrollView. (This is a copy of https://github.com/flutter/flutter/issues/39715 as it has been closed with no solution)

Even Google official Package for indexed lists (https://pub.dev/packages/scrollable_positioned_list) is using center to set the initial position. We need an official solution to this issue.

```dart
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  Key centerKey = UniqueKey();
  int initialTopItemIndex = 5;
  List<Widget> list = List<Widget>();

  @override
  Widget build(BuildContext context) {
    for(int i = 0; i < 100; i++) {
      list.add(ListTile(title: Text('$i')));
    }

    return Scaffold(
      body: CustomScrollView(
        center: centerKey,
        slivers: [
          SliverAppBar(
            title: Text('Sliver App Bar'),
            floating: true,
            snap: true,
          ),
          SliverList(
            delegate: SliverChildListDelegate(
              list.sublist(0, initialTopItemIndex).reversed.toList(),
            ),
          ),
          SliverList(
            key: centerKey,
            delegate: SliverChildListDelegate(
              list.sublist(initialTopItemIndex, initialTopItemIndex + 1),
            ),
          ),
          SliverList(
            delegate: SliverChildListDelegate(
              list.sublist(initialTopItemIndex + 1),
            ),
          ),
        ],
      ),
    );
  }
}
```

**Expected results:** 

The Appbar should be able to float/pin/snap regardless of the use of a center property

**Actual results:** 

The app bar stays on top of the list and gets scrolled

<details>
  <summary>Logs</summary>

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
[✓] Flutter (Channel stable, 3.7.6, on macOS 13.2.1 22D68 darwin-arm64, locale
    en-CA)
    • Flutter version 3.7.6 on channel stable at /Users/adi/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 12cb4eb7a0 (6 days ago), 2023-03-01 10:29:26 -0800
    • Engine revision ada363ee93
    • Dart version 2.19.3
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/adi/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • 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.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] 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.76.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.60.0

[✓] Connected device (3 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64  • Android 13
      (API 33) (emulator)
    • macOS (desktop)             • macos         • darwin-arm64   • macOS
      13.2.1 22D68 darwin-arm64
    • Chrome (web)                • chrome        • web-javascript • Google
      Chrome 110.0.5481.177

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
```

</details>