Skip to content

Mouse scrolling does not trigger showing SliverPersistentHeader when floating is set to true #75059

Closed

Description

@radoslaw-sz

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

Activity

  1. iapicca commented on Jan 30, 2021

    @iapicca

    @mordivgor
    as I mentioned here should be fixed in master #66039

    please try

    flutter channel master
    flutter upgrade -f
  2. radoslaw-sz commented on Jan 30, 2021

    @radoslaw-sz
    Author

    @iapicca unfortunately, not working with 1.26.0-18.0.pre.90 • channel master

  3. darshankawar commented on Feb 1, 2021

    @darshankawar
    Member

    @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 ?

  4. added
    in triagePresently being triaged by the triage team
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Feb 1, 2021
  5. radoslaw-sz commented on Feb 5, 2021

    @radoslaw-sz
    Author
    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.

  6. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Feb 5, 2021
  7. darshankawar commented on Feb 8, 2021

    @darshankawar
    Member
    flutter doctor -v
    [✓] Flutter (Channel master, 1.26.0-18.0.pre.212, on Mac OS X 10.15.4 19E2269
        darwin-x64, locale en-IN)
        • Flutter version 1.26.0-18.0.pre.212 at
          /Users/dhs/documents/Fluttersdk/flutter
        • Framework revision 02d441ea55 (2 days ago), 2021-02-05 17:17:12 -0800
        • Engine revision b04955656c
        • Dart version 2.13.0 (build 2.13.0-0.0.dev)
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
        • Android SDK at /Users/dhs/Library/Android/sdk
        • Platform android-30, build-tools 30.0.0
        • Java binary at: /Applications/Android
          Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build
          1.8.0_242-release-1644-b3-6915495)
        • All Android licenses accepted.
    
    [!] Xcode - develop for iOS and macOS
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 12.3, Build version 12C33
        ! CocoaPods 1.9.3 out of date (1.10.0 is recommended).
            CocoaPods is used to retrieve the iOS and macOS platform side's plugin
            code that responds to your plugin usage on the Dart side.
            Without CocoaPods, plugins will not work on iOS or macOS.
            For more info, see https://flutter.dev/platform-plugins
          To upgrade see
          https://guides.cocoapods.org/using/getting-started.html#installation for
          instructions.
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 4.1)
        • Android Studio at /Applications/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
          1.8.0_242-release-1644-b3-6915495)
    
    [✓] VS Code (version 1.52.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.18.1
    
    [✓] Connected device (2 available)
        • macOS (desktop) • macos  • darwin-x64     • Mac OS X 10.15.4 19E2269
          darwin-x64
        • Chrome (web)    • chrome • web-javascript • Google Chrome 88.0.4324.150
    
    ! Doctor found issues in 1 category.
    
  8. added
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    platform-webWeb applications specifically
    a: mouseIssues related to using a mouse or mouse support
    f: scrollingViewports, list views, slivers, etc.
    frameworkflutter/packages/flutter repository. See also f: labels.
    and removed
    in triagePresently being triaged by the triage team
    on Feb 8, 2021
  9. 2 remaining items

  10. changed the title [-][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[/+] on Feb 11, 2021
  11. Piinks commented on Feb 12, 2021

    @Piinks
    Contributor

    Reproduced on 1.27.0-2.0.pre.75

    Floating slivers, like SliverPersistentHeader and SliverAppBar are affected by this. This is because the floating is informed by listening to the ScrollPosition.isScrollingNotifier.
    pointerScroll does not account for the isScrollingNotifier, while when you drag on the scrollable, the DragScrollActivity does update it.

    I think. Still investigating. 🤔

  12. self-assigned this
    on Feb 12, 2021
  13. Piinks commented on Feb 12, 2021

    @Piinks
    Contributor

    This should block #71322 / #75728

  14. added
    P2Important issues not at the top of the work list
    on Feb 18, 2021
  15. Piinks commented on Mar 17, 2021

    @Piinks
    Contributor

    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.

  16. inceptusp commented on Apr 19, 2021

    @inceptusp

    @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...

  17. Piinks commented on Apr 19, 2021

    @Piinks
    Contributor

    @inceptusp Thank you for providing some examples! This is very helpful. :)

  18. added
    r: fixedIssue is closed as already fixed in a newer version
    on Apr 30, 2021
  19. github-actions commented on Aug 2, 2021

    @github-actions

    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 -v and a minimal reproduction of the issue.

  20. locked as resolved and limited conversation to collaborators on Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: desktopRunning on desktopa: mouseIssues related to using a mouse or mouse supportf: scrollingViewports, list views, slivers, etc.found in release: 1.26Found to occur in 1.26frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions