Skip to content

Conversation

@xster
Copy link
Member

@xster xster commented Apr 18, 2018

Fixes #16529

This makes sure on iOS that:

  1. Slow creeping scroll moves still don't gradually drift from finger
  2. Hesitant drag starts don't jump by too many pixels initially
  3. Determined drag starts has closer to the inertia feeling on iOS
  4. Strong flings don't lose the responsive feel
  5. Scroll position is still somewhat 'sticky' when becoming stationary

@xster xster force-pushed the ios-scroll-start branch from cf61926 to 9f55b6e Compare April 18, 2018 22:57
@Hixie
Copy link
Contributor

Hixie commented Apr 18, 2018

How does this code end up only affecting iOS?

@xster
Copy link
Member Author

xster commented Apr 18, 2018

Only the iOS's scroll behaviour physics sets a motionStartDistanceThreshold on the ScrollDragController. Otherwise, all drag motions transparently falls through to applyUserOffset.

@Hixie
Copy link
Contributor

Hixie commented Apr 18, 2018

One thing we might want to do is change our gesture recognizers to not do the jump, by having them start at zero offset when they "win". (Presumably we'd make that configurable, and the question here is just what the default configuration should be for those created by a GestureDetector.)

cc @HansMuller who was interested in that particular idea.

return true;
// Already in motion or no threshold behavior configured.
// Allow transparent offset transmission.
return offset;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add some comments in this method that talk about how by default, Android falls down one path and iOS the other, and point to the class that sets things up that way? Thanks.

@Hixie
Copy link
Contributor

Hixie commented Apr 18, 2018

LGTM

@xster
Copy link
Member Author

xster commented Apr 18, 2018

I think it's sensible to make it tiered (partially gated here and partially gated in the gesture detector) and also add something similar to the gesture detector.
We'd indeed want them to be configurable. Otherwise, winning at zero will make deliberate flings feel sluggish.

In the long run, I still want to model iOS scrolls specifically to #13171 (it's just really hard to reverse engineer it) but that wouldn't apply to general gesture detectors so we still need 2 paths I think.

But having it on gestures will solve a similar problem with things like back swipe which also 'jumps' in Flutter and doesn't natively.

@xster xster force-pushed the ios-scroll-start branch from d713ffd to ebc2c08 Compare April 19, 2018 01:03
@xster xster merged commit 133c98a into flutter:master Apr 19, 2018
@xster xster deleted the ios-scroll-start branch April 19, 2018 23:17
DaveShuckerow pushed a commit to DaveShuckerow/flutter that referenced this pull request May 14, 2018
* Fine-tune iOS's scroll start feel

* remove negations in doc

* Our own dart-side gesture arena also contributes to the 'jerk'. Make sure that snap is accounted as well.

* Added more code comments from review.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gestures lag at edge of screen

3 participants