Repository navigation
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.6Found to occur in 3.6Found to occur in 3.6frameworkflutter/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 onteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Description
Steps to Reproduce
- Execute
flutter runon the code sample - Tap "Sliver Persistent Header" Button
- Too much Scroll Until it reach the bottom
Expected results: Gently arrive at the top both pinned & not pinned
Actual results: Gently arrive at the top when not pinned. However, if use it after pinned it, it scrolls very violently
Pinned.mp4
NotPinned.mp4
Code sample
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
late final ScrollController scrollController;
@override
void initState() {
super.initState();
scrollController = ScrollController();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: CustomScrollView(
controller: scrollController,
slivers: [
SliverToBoxAdapter(
child: Container(
height: 400,
color: Colors.grey,
),
),
const SliverPersistentHeader(
pinned: true,
delegate: SliverHeaderDelegate(),
),
SliverList(
delegate: SliverChildBuilderDelegate((context, index) {
return Container(
height: 40,
color: Color.fromRGBO(
(index * 45) % 255, (index * 70) % 255, (index * 25), 1.0),
);
}, childCount: 200),
),
const SliverToBoxAdapter(
child: Text(
"I'm Bottom",
textAlign: TextAlign.center,
),
)
],
),
);
}
}
class SliverHeaderDelegate extends SliverPersistentHeaderDelegate {
const SliverHeaderDelegate();
@override
Widget build(
BuildContext context, double shrinkOffset, bool overlapsContent) {
return Container(
color: Colors.white,
height: 48,
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: TextButton(
onPressed: () {
Scrollable.ensureVisible(
context,
alignment: 0.000,
duration: const Duration(seconds: 1),
);
},
child: const Text("Sliver Persistent Header")),
);
}
@override
double get maxExtent => 48;
@override
double get minExtent => 48;
@override
bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) {
return false;
}
}
Logs
Analyzing sliver_persistent_header_ensure_visible_bug...
No issues found! (ran in 1.3s)
[✓] Flutter (Channel stable, 3.3.8, on macOS 13.0 22A380 darwin-arm, locale ko-KR)
• Flutter version 3.3.8 on channel stable at /Users/adforus/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc25f6 (2 weeks ago), 2022-11-09 12:09:26 +0800
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/adforus/Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: /Users/adforus/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.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14B47b
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Users/adforus/Downloads/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.10+0-b96-7249189)
[✓] Android Studio (version 2021.3)
• Android Studio at /Users/adforus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9014738/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)
[✓] Android Studio (version 2021.3)
• Android Studio at /Users/adforus/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/adforus/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
• Flutter plugin version 71.0.5
• Dart plugin version 222.4345.14
[✓] IntelliJ IDEA Ultimate Edition (version 2022.2.2)
• IntelliJ at /Users/adforus/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.4167.29/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
[✓] IntelliJ IDEA Ultimate Edition (version 2022.2.3)
• IntelliJ at /Users/adforus/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
[✓] VS Code (version 1.59.1)
• VS Code at /Users/adforus/Downloads/Visual Studio Code.app/Contents
• Flutter extension version 3.27.0
[✓] Connected device (3 available)
• Pixel 7 (mobile) • 29281FDH200DQD • android-arm64 • Android 13 (API 33)
• macOS (desktop) • macos • darwin-arm64 • macOS 13.0 22A380 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 107.0.5304.110
[!] HTTP Host Availability
✗ HTTP host "https://cloud.google.com/" is not reachable. Reason: Failed to connect to host in 10 seconds
! Doctor found issues in 1 category.
Reacted by Martin Sellergren, Baroni, NikHomann, Stephen Vaudreuil and Jesse
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.6Found to occur in 3.6Found to occur in 3.6frameworkflutter/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 onteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Activity
exaby73 commentedon Nov 24, 2022
Triage report
I can reproduce this issue with the code sample provided on
Master (3.6.0-7.0.pre.47). This only occurs withpinned: true.Code Sample (Same as OP)
[-]When Scrollable.ensureVisible to Pinned SliverPersistentHeader Too much Scroll.[/-][+]When calling `Scrollable.ensureVisible` to pinned `SliverPersistentHeader`, the view scrolls too much[/+]Use leading scroll offset instead of infinite offset to reveal pinned…
github-actions commentedon Sep 11, 2026
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.