Skip to content

ScrollPosition.isScrollingNotifier returns false when using scroll-wheel and two-finger gesture in trackpad #75591

Description

@jamesblasco

I have only tried this on a mac device, as a mac app and a web app. When using the trackpad to scroll a view, the ScrollPosition.isScrollingNotifier
returns false.
If I scroll by clicking and dragging it, the notifier returns true.

At least on macos, the default way of scrolling into views is using the two-finger gesture. If you click and drag inside a native app, this one does not scroll, but a Flutter app does.

Steps to Reproduce

import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(home: MyListView()));
}
class MyListView extends StatefulWidget {
  @override
  _MyListViewState createState() => _MyListViewState();
}

class _MyListViewState extends State<MyListView> {
  final ScrollController controller = ScrollController();

  @override
  void initState() {
    controller.addListener(() {
      // always prints "scrolling = true"
      print('scrolling = ${controller.position.isScrollingNotifier.value}');
    });
    super.initState();
  }

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(body: ListView.builder(
      controller: controller,
      itemCount: 20,
      itemBuilder: (BuildContext context, int index) {
        return ListTile( 
          title: Text('$index'),
        );
      },
    ),
    );
  }
}
Flutter (Channel dev, 1.26.0-12.0.pre, on macOS 11.1 20C69 darwin-x64, locale en-ES)

Activity

  1. jamesblasco commented on Feb 7, 2021

    @jamesblasco
    ContributorAuthor

    I think it has to do with this

    As of right now Flutter scroll wheel events are analyzed as a series of single events.

  2. darshankawar commented on Feb 8, 2021

    @darshankawar
    Member

    Verified this on latest beta and master using web.

    scrolling = false
    scrolling = false
    scrolling = false
    scrolling = false
    scrolling = false
    scrolling = true
    scrolling = true
    scrolling = true
    scrolling = true
    scrolling = true
    scrolling = true
    
    
    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 (3 available)
        • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729 • ios
          • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • 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.
    
    
  3. added
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    f: scrollingViewports, list views, slivers, etc.
    frameworkflutter/packages/flutter repository. See also f: labels.
    platform-iosiOS applications specifically
    platform-macosBuilding on or for macOS specifically
    on Feb 8, 2021
  4. changed the title [-]ScrollPosition.isScrollingNotifier returns false when using two-finger gesture in trackpad[/-] [+]ScrollPosition.isScrollingNotifier returns false when using scroll-wheel and two-finger gesture in trackpad[/+] on Feb 8, 2021
  5. singularity-s0 commented on Feb 8, 2022

    @singularity-s0

    This issue is also seriously affecting scrolling experience for iPad users (#97084). Any updates on this?

  6. added
    P2Important issues not at the top of the work list
    on Jun 9, 2022
  7. gdutkyle commented on Jun 22, 2022

    @gdutkyle

    hello @Piinks ,any update? our team is struggle in this issue for a long time

  8. WithToken commented on Oct 20, 2022

    @WithToken

    Any updates on this? iPadOS.

  9. self-assigned this
    on Oct 24, 2022
  10. Piinks commented on Oct 24, 2022

    @Piinks
    Contributor

    This is fixed for trackpad, but not for scroll wheel on mouse. I'll have a PR up for it shortly.

  11. added
    r: fixedIssue is closed as already fixed in a newer version
    on Oct 31, 2022
  12. github-actions commented on Nov 14, 2022

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

  13. locked as resolved and limited conversation to collaborators on Nov 14, 2022
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 listf: 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 onplatform-iosiOS applications specificallyplatform-macosBuilding on or for macOS specificallyr: 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