Repository navigation
NestedScrollView physics not working #113753
Copy link
Copy link
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 3.3Found to occur in 3.3Found to occur in 3.3found in release: 3.4Found to occur in 3.4Found to occur in 3.4frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Steps to Reproduce
- Execute
flutter runon the code sample - Just scroll the view
Expected results:
Scroll should not work in this example
Actual results:
User can scroll. We lost the ability to have custom physics like Clamping or Bouncing.
Code sample
import 'package:flutter/material.dart';
void main() {
runApp(const MaterialApp(home: Home()));
}
class Home extends StatelessWidget {
const Home({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: NestedScrollView(
physics: const NeverScrollableScrollPhysics(),
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) => <Widget>[
SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
sliver: const SliverAppBar(
pinned: true,
elevation: 0,
backgroundColor: Colors.blue,
toolbarHeight: kToolbarHeight,
expandedHeight: 200,
flexibleSpace: FlexibleSpaceBar(
title: Text("Physics not working"),
),
),
),
],
body: Builder(
builder: (BuildContext context) => CustomScrollView(
physics: const NeverScrollableScrollPhysics(),
slivers: <Widget>[
SliverOverlapInjector(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
),
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) => Card(
child: ListTile(
leading: const Icon(Icons.search),
title: Text(index.toString()),
),
),
childCount: 200,
),
),
],
),
),
),
);
}
}Logs
[✓] Flutter (Channel stable, 3.3.4, on macOS 12.6 21G115 darwin-arm, locale fr-FR)
• Flutter version 3.3.4 on channel stable at /Users/earminjon/fvm/versions/3.3.4
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision eb6d86ee27 (2 weeks ago), 2022-10-04 22:31:45 -0700
• Engine revision c08d7d5efc
• Dart version 2.18.2
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/earminjon/Library/Android/Sdk
• Platform android-33, build-tools 33.0.0
• ANDROID_HOME = /Users/earminjon/Library/Android/Sdk
• Java binary at: /Users/earminjon/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14A400
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.3)
• Android Studio at /Users/earminjon/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335/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.13+0-b1751.21-8125866)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.2.3)
• IntelliJ at /Users/earminjon/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
• Flutter plugin version 70.2.5
• Dart plugin version 222.4345.14
[✓] IntelliJ IDEA Ultimate Edition (version 2022.2.3)
• IntelliJ at /Users/earminjon/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.4345.14/IntelliJ IDEA.app
• 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
[✓] Connected device (3 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 13 (API 33) (emulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.6 21G115 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 106.0.5249.119
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 3.3Found to occur in 3.3Found to occur in 3.3found in release: 3.4Found to occur in 3.4Found to occur in 3.4frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version

Activity
exaby73 commentedon Oct 20, 2022
Triage report
I can reproduce this issue on
Master (3.5.0-9.0.pre.32)Code Sample
cer-cer commentedon Oct 21, 2022
yes, i also have this problem.
goderbauer commentedon Oct 25, 2022
@Piinks
Hynsen commentedon Apr 4, 2023
I have the same problem, Has anyone solved this problem?
Piinks commentedon Apr 4, 2023
I thought this might be related to #45619, but this seems separate from that to me.
Piinks commentedon Apr 4, 2023
It looks like we apply clamping scroll physics to whatever physics is already supplied:
flutter/packages/flutter/lib/src/widgets/nested_scroll_view.dart
Line 437 in 34d2c8d
@xu-baolin has been looking at a similar issue where DraggableScrollableSheet automatically applies AlwaysScrollableScrollPhysics (#121021 | #123109)
github-actions commentedon Apr 26, 2023
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.