Repository: flutter
Issue: CustomScrollView's pinned SliverAppBar goes behind NestedScrollView's pinned SliverAppBar
Labels: framework,f: scrolling,d: stackoverflow,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

Just copy paste the code in the main.dart and run the code 


### Expected results

I want that the blue silverAppBar should be pinned below the red silverAppBar

### Actual results

but the blue silverAppBar is getting pinned behind the red sIlverAppBar

### Code sample

<details><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: NestedScrollView(
          headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) => <Widget>[
            const SliverAppBar(
              pinned: false,
              backgroundColor: Colors.amber,
            ),
            const SliverAppBar(
              pinned: true,
              backgroundColor: Colors.red,
            ),
          ],
          body: Builder(
            builder: (BuildContext context) {
              return RefreshIndicator(
                onRefresh: () {
                  return Future(() => null);
                },
                child: CustomScrollView(
                  slivers: [
                    SliverList(
                      delegate: SliverChildBuilderDelegate(
                        (BuildContext context, int index) {
                          return const ListTile(
                            title: Text(
                              'Sample Row',
                              style: TextStyle(color: Color.fromARGB(255, 0, 0, 0)),
                            ),
                          );
                        },
                        childCount: 2,
                      ),
                    ),
                    const SliverAppBar(
                      pinned: true,
                      backgroundColor: Colors.blue,
                    ),
                    SliverList(
                      delegate: SliverChildBuilderDelegate(
                        (BuildContext context, int index) {
                          return const ListTile(
                            title: Text(
                              'Sample Row',
                              style: TextStyle(color: Color.fromARGB(255, 0, 0, 0)),
                            ),
                          );
                        },
                        childCount: 30,
                      ),
                    ),
                  ],
                ),
              );
            },
          ),
        ),
      ),
    );
  }
}
```

</details>


### Screenshots or Video

<details>
<summary>Video demonstration</summary>


[bugVideo.webm](https://github.com/flutter/flutter/assets/99040717/330ed3cd-5875-4760-aeca-42f3b1a9ab4e)


</details>


### Logs

<details><summary>Logs</summary>

```console
[Paste your logs here]
```

</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.0, on Microsoft Windows [Version 10.0.19045.2965], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.11.26)
[√] Android Studio (version 2022.1)
[√] VS Code (version 1.79.1)
[√] Connected device (4 available)
[√] Network resources

• No issues found!
```

</details>