Repository navigation
Mouse scrolling does not trigger showing SliverPersistentHeader when floating is set to true #75059
Copy link
Copy link
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: desktopRunning on desktopRunning on desktopa: mouseIssues related to using a mouse or mouse supportIssues related to using a mouse or mouse supportf: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 1.26Found to occur in 1.26Found to occur in 1.26frameworkflutter/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
Generally, not sure if bug or feature request...
Expected results:
SliverPesistentHeader shall be slowly shown when I mouse scrolling in up direction.
It works with dragging.
Actual results:
SliverPesistentHeader is not shown while mouse scrolling - it is visible only when scroll reaches the beginning of the page.
Code
import 'package:flutter/material.dart';
void main() {
runApp(SliverPesistentHeaderScrollUpMouse());
}
class SliverPesistentHeaderScrollUpMouse extends StatelessWidget {
@override
Widget build(BuildContext context) {
List<Widget> _widgets = [];
for (int i = 0; i < 200; i++) {
_widgets.add(
Container(
height: 10,
color: Colors.blue,
)
);
}
return MaterialApp(
title: 'Default label',
home: Scaffold(
body: CustomScrollView(
slivers: [
SliverPersistentHeader(
floating: true,
delegate: Header(),
),
SliverList(
delegate: SliverChildListDelegate(
_widgets
),
)
],
)
)
);
}
}
class Header extends SliverPersistentHeaderDelegate {
@override
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
return Container(
height: 50,
color: Colors.red,
);
}
@override
double get maxExtent => 50;
@override
double get minExtent => 50;
@override
bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) {
return false;
}
}
Flutter doctor
[√] Flutter (Channel beta, 1.25.0-8.1.pre, on Microsoft Windows [Version 10.0.19041.746], locale pl-PL)
• Flutter version 1.25.0-8.1.pre at G:\IOT\flutter\flutter
• Framework revision 8f89f6505b (7 weeks ago), 2020-12-15 15:07:52 -0800
• Engine revision 92ae191c17
• Dart version 2.12.0 (build 2.12.0-133.2.beta)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\Radek\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 39.0.3
• Dart plugin version 191.8423
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] Connected device (2 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.104
• Edge (web) • edge • web-javascript • Microsoft Edge 87.0.664.75
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 lista: desktopRunning on desktopRunning on desktopa: mouseIssues related to using a mouse or mouse supportIssues related to using a mouse or mouse supportf: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 1.26Found to occur in 1.26Found to occur in 1.26frameworkflutter/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
iapicca commentedon Jan 30, 2021
@mordivgor
as I mentioned here should be fixed in master #66039
please try
radoslaw-sz commentedon Jan 30, 2021
@iapicca unfortunately, not working with 1.26.0-18.0.pre.90 • channel master
darshankawar commentedon Feb 1, 2021
@mordivgor
I tried your code sample on latest master (pre.90) but not sure what exactly the issue is. Can you provide a video of what's the expected vs actual behavior should be ?
radoslaw-sz commentedon Feb 5, 2021
scrolling.persistent.header.mp4
@darshankawar here you are.
The thing is - when I am scrolling up, persistent header does not show up. When I am dragging, it is shown properly.
darshankawar commentedon Feb 8, 2021
flutter doctor -v
2 remaining items
[-][web] Mouse scrolling does not trigger showing SliverPersistentHeader when floating is set to true[/-][+]Mouse scrolling does not trigger showing SliverPersistentHeader when floating is set to true[/+]Piinks commentedon Feb 12, 2021
Reproduced on 1.27.0-2.0.pre.75
Floating slivers, like
SliverPersistentHeaderandSliverAppBarare affected by this. This is because the floating is informed by listening to theScrollPosition.isScrollingNotifier.pointerScrolldoes not account for theisScrollingNotifier, while when you drag on the scrollable, theDragScrollActivitydoes update it.I think. Still investigating. 🤔
Piinks commentedon Feb 12, 2021
This should block #71322 / #75728
Piinks commentedon Mar 17, 2021
In discussing this with @goderbauer we weren't sure if this is a behavior that is expected from a mouse scroll. This may be a touch-specific behavior, will need to research further.
inceptusp commentedon Apr 19, 2021
@Piinks I think it should be... I've seen sites all over the web with this type of behaviour for theirs navbars... Inclusive, I was trying to achieve this type of behaviour on a site I'm developing and crossed with this "bug" right now... Here are two examples of sites that have this behaviour:
FormatFactory.Registro.de.tela20210419_010050.mp4
FormatFactory.Registro.de.tela20210419_010801.mp4
"Terra" is a Brazilian news portal from the Telefónica phone carrier... And "Claro" is a phone carrier on Brazil and a dozen of American countries... And some English examples: Nintendo, itv and ViacomCBS...
If you see, when I scroll up, their navbar shows right away, I don't need to reach the top of the page and I am not using touch...
Piinks commentedon Apr 19, 2021
@inceptusp Thank you for providing some examples! This is very helpful. :)
github-actions commentedon Aug 2, 2021
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.