Skip to content

[web] Add possibility to provide custom gesture callbacks to ScrollView class #45898

@mikepyts

Description

@mikepyts

Pre-history:
This is one of the issues:
#45893
#45896
#45897
which have been found on the way to make ListView in Flutter for web scrollable with a finger on touch screen, alternative for this is scrolling a list with a mouse pointer.

Steps to Reproduce

  1. Create a new Flutter project
  2. Copy content of the gist https://gist.github.com/mikepyts/7b63b8e5086d4606c0d25631d27d5755 to the main.dart.
  3. Copy content of the gist https://gist.github.com/mikepyts/666961b23a7120cd45f3d6b3894caaf6 to the separate custom_scrollbar.dart
  4. Copy content of the gist https://gist.github.com/mikepyts/195263ee630b1add69d2f53af3fb9e0a to the separate custom_scollable.dart
  5. Copy content of the gist https://gist.github.com/mikepyts/54dcb4c3cb1ea3b5aacfe92f83e25a60 to the separate custom_scrollview.dart
  6. Uncomment issue number 3.3
  7. Correct import issues
  8. Run the project
  9. Observe the behavior needed to achieve scrolling of any scrollable from ScrollView.dart with a single finger (pan) or with a mouse pointer.

Expected results
Out of the box, Scrollable can be scrolled with a touchbar or mouse wheel, but it is hard to provide precise scrolling for touch screens on the web platform with a single finger or mouse pointer. To make it work I have copied SDK source code content to the separate files and changed:
https://drive.google.com/open?id=1P98RCvqaisxLYqt5oQ53dZTAxaESQsYe

  1. In ScrollView - use own Scrollable implementation for scrollable property inside the build method:
    image
  2. In Scrollable have added Scale gesture callbacks to the RawGestureRecognizer factories:
    image

Actual results
Scrollable can not be scrolled with a single finger or mouse pointer

Target Platform: Web
Target OS version/browser: MacOS Catalina, Chrome

Flutter doctor

[✓] Flutter (Channel master, v1.12.16-pre.35, on Mac OS X 10.15.1 19B88, locale en-UA)
    • Flutter version 1.12.16-pre.35 at /Users/mike/Documents/flutter_master
    • Framework revision b9a56b9f48 (2 days ago), 2019-11-29 20:40:44 -0500
    • Engine revision 8672e79af8
    • Dart version 2.7.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Connected device (2 available)
    • Chrome     • chrome     • web-javascript • Google Chrome 78.0.3904.108
    • Web Server • web-server • web-javascript • Flutter Tools

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterf: gesturesflutter/packages/flutter/gestures repository.frameworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions