New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add macOS-specific scroll physics #108298
Conversation
im having trouble understanding this graph. is y-axis the initial distance or initial speed? |
The y-axis is velocity |
Thanks so much for this @moffatman! And apologies for the delay, I should be finished reviewing today |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You want to update the getScrollPhysics of CupertinoScrollBehavior as well. 👍
/// | ||
/// To obtain a velocity, call [getVelocity] or [getVelocityEstimate]. The | ||
/// estimated velocity is typically used as the initial flinging velocity of a | ||
/// `Scrollable`, when its drag gesture ends. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the docs for the iOS version, there is a reference to https://developer.apple.com/documentation/uikit/uiscrollviewdelegate/1619385-scrollviewwillenddragging, is that also relevant here? Or is there another, more relevant reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There isn't a direct analogue, in AppKit the scroll momentum state is seen based on the incoming events' [NSEvent momentumPhase]
. The part which converts the velocity to the momentum is not exposed at all.
662fddf
to
63529d1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking really good. Apologies for the delay while I was gone.
double g = guess; | ||
for (int i = 0; i < iterations; i++) { | ||
g = g - (f(g) - target) / df(g); | ||
} | ||
return g; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The style guide discourages abbreviations https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#avoid-abbreviations
Can you expand this shorthand so it is easier to understand?
63529d1
to
e4c60d1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really great, thank you for your incredible attention to detail. :)
LGTM!
which flutter version will this land in? |
@appinteractive Has been in beta channel for a while, should be in the next stable version 3.7. No idea when that releases though |
IIRC next release will be around next Jan @appinteractive |
Thanks for the response, tried it in 3.7 pre but I still have scroll that has way to little friction on macOS, do I need to specify anything for it to work? Using MaterialApp as a base because Cupertino is barely usable with plugins. (Missing Material) |
@appinteractive Can you share some code which reproduces the issue? If you are setting custom scroll physics on any widget, the correct physics for macOS should be |
@Piinks After the release of Flutter 3.7 with this included, I'm seeing EDIT: It's also worth mentioning that the errors I'm getting do not trace which scrollable the issue is arising from :/ |
Hi @GroovinChip, it sounds like there may be a regression. Can you please file an issue with the last flutter version you were using and a minimal reproduction? |
@Piinks Sure thing! Didn't realize it could be a regression :) |
Done - #119323 |
Dotted line =
BouncingScrollPhysics
Solid line = new
BouncingDesktopScrollPhysics
X-marks = Recorded data
Fixes #107752
Pre-launch Checklist
///
).