Repository: flutter
Issue: Custom ScrollPhysics is not applied in NestedScrollView when SliverAppBar is still expanded
Labels: framework,f: scrolling,has reproducible steps,P2,team-framework,triaged-framework,found in release: 3.13,found in release: 3.17

### 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

1. Wrap a SliverAppBar and a CustomScrollView in a NestedScrollView
2. Create a ScrollPhysics class that slows down the useroffset by a factor
3. Apply this phyics to the NestedScrollView and the CustomScrollView

### Expected results

The scroll motion gets slowed down

### Actual results

The scroll motion only gets slowed down when the SliverAppBar is fully collapsed AND we are scrolling down. When scrolling up and the SliverAppBar is collapsed, it is the same speed/the applyPhysicsToUserOffset method does not get called (as when we are scrolling down and the SliverAppbar is slowly collapsing)

### Code sample

<details><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';

class SlowScrollPage extends StatelessWidget {
  const SlowScrollPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Slow Scroll Example')),
      body: NestedScrollView(
        headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
          return <Widget>[
            SliverAppBar(
              title: const Text('SliverAppBar'),
              pinned: true,
              expandedHeight: 200.0,
              flexibleSpace: FlexibleSpaceBar(
                background: Image.network(
                  'https://placekitten.com/400/200',
                  fit: BoxFit.cover,
                ),
              ),
            ),
          ];
        },
        body: CustomScrollView(
          // Apply the SlowScrollPhysics here
          physics: const SlowScrollPhysics(),
          slivers: <Widget>[
            SliverList(
              delegate: SliverChildBuilderDelegate(
                (BuildContext context, int index) {
                  return ListTile(title: Text('Item #$index'));
                },
                childCount: 30, // Number of list items
              ),
            ),
          ],
        ),
      ),
    );
  }
}

class SlowScrollPhysics extends ScrollPhysics {
  final double scrollSpeedRatio;

  const SlowScrollPhysics({ScrollPhysics? parent, this.scrollSpeedRatio = 0.25})
      : super(parent: parent);

  @override
  SlowScrollPhysics applyTo(ScrollPhysics? ancestor) {
    return SlowScrollPhysics(
        parent: buildParent(ancestor), scrollSpeedRatio: scrollSpeedRatio);
  }

  @override
  double applyPhysicsToUserOffset(ScrollMetrics position, double offset) {
    return super.applyPhysicsToUserOffset(position, offset * scrollSpeedRatio);
  }
}

```

</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
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.13.9, on Microsoft Windows [Version 10.0.22621.2428], locale de-DE)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.6)
[√] Android Studio (version 2022.3)
[√] Connected device (4 available)
    ! Device R58M56F1JEH is not authorized.
      You might need to check your device for an authorization dialog.
[√] Network resources

• No issues found!
```

</details>