Skip to content

Conversation

@Piinks
Copy link
Contributor

@Piinks Piinks commented Nov 14, 2022

WIP

Fixes #32120

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added a: text input Entering text in a text field or keyboard related problems f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. labels Nov 14, 2022
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@Piinks Piinks requested a review from yjbanov November 14, 2022 23:10
assert(delta != 0.0);

if (animatePointerScroll) {
double currentPosition = _outerPosition?.pixels ?? 0.0;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another point for #102003, this kind of info should be more accessible.

if (animatePointerScroll) {
double currentPosition = _outerPosition?.pixels ?? 0.0;
for (final _NestedScrollPosition innerPosition in _innerPositions) {
currentPosition += innerPosition.pixels;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO(me): fix this.

Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From some manual Q/A:

  • If scroll wheel event are high enough frequency, the scrolling velocity is reset to zero on every click.
  • In the Gallery home page, the horizontally scrollable carousel of demos overscrolls the target item then scrolls back to it. This happens when using the arrow button to scroll. I don't think we support horizontal scrolling using the mouse wheel (?), so I didn't test it.

Comment on lines 283 to 291
_animating = true;
moveTo(
newTargetPixels,
duration: Duration(milliseconds: updatedDuration.round()),
curve: Curves.easeInOut,
).whenComplete(() {
_animating = false;
_lastVelocity = 0.0;
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines can be mostly deduplicated with the ones in the if block, saving a few bytes in download size.

@Piinks
Copy link
Contributor Author

Piinks commented Nov 15, 2022

If scroll wheel event are high enough frequency, the scrolling velocity is reset to zero on every click.

Is this a case where the scroll direction is changing? I recall you mentioned testing this with the Gallery app, did you opt-in for each individual demo? I think you said you saw it in action on the home page, if you set MaterialApp.scrollBehavior to opt in at that level, the demoes with their own MaterialApps override it. They each need to set it in the Gallery app since they are designed as stand alone apps within the gallery app.

@Piinks Piinks mentioned this pull request Nov 18, 2022
8 tasks
@goderbauer goderbauer marked this pull request as draft November 22, 2022 23:02
@flutter-dashboard
Copy link

This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

from: pixels,
to: newTargetPixels,
duration: Duration(milliseconds: newDuration.round()),
curve: Cubic(0.42, carriedVelocity, 0.58, 1.0),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yjbanov this is the updated curve

Copy link
Contributor Author

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yjbanov now that flutter/engine#36346 has landed, can you try this again? Since we can now identify trackpads, I have filtered them out. :)

@Piinks
Copy link
Contributor Author

Piinks commented Feb 7, 2023

Closing for now since there has been no feedback. Will look at returning to this in a few weeks.

@Piinks Piinks closed this Feb 7, 2023
@DexEze
Copy link

DexEze commented Nov 16, 2023

I wonder if you can pick this back up @Piinks?
It would be good to have a smooth scroll on desktop and web with mouse scroll wheel

@water-mizuu
Copy link

Please look into picking this back up @Piinks 😢, as of now, I've been using my own fork of pub.dev/smooth_scroll_multiplatform, which breaks with NotificationListeners.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to smoothly animate stepped mouse scroll deltas

4 participants