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
Android scroll speed deceleration rate doesn't match native #16371
Comments
Have you had a chance to look at https://flutter.io/ui-performance/ ? |
Not sure what you were pointing out from the video. Is it that friction is too high and the flings slow down too quickly towards the end? |
@xster Yes, it is that friction is too high and the flings slow down too quickly towards the end. Comparing it with native views, there is tiny difference. I looked at the performance, it is normal. |
Yes it does look a bit off. Would you mind comparing with our gallery app (https://play.google.com/store/apps/details?id=io.flutter.demo.gallery)? Couldn't tell from the video but it does look a bit different from our default expected behaviour too. |
@xster Thanks for your suggestion, I've compared with the gallery app, I think the difference is still existing. I'm comparing the scroll gallery with any android native app, the smooth is tiny different but I don't know how to figure the difference with test results, I'm just observing between them. Or else can you tell me the principle or code position of the scroll speed of Flutter? |
They're different per platform but for Android, it's at https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/widgets/scroll_simulation.dart#L141 (which I believe is extracted from the Android source code). It's also all configurable via the |
I can easily notice the different when using lists example from https://github.com/flutter/gallery and Play store flutter doctor -v
|
this tiny difference of scroll behavior between native and flutter should be important to users |
Changing But the problem is the default friction is 0.015 and algorithm also from android source, so what's wrong with flutter? |
I agree scrolling feels different in flutter vs native. Noticed after upgrading to flutter 2.0.0 that scrolling seems much more slippy. Using defaults, can now easily fling through a ListView of 300+ items with one flick. Whereas native it might take 3 or 4 flicks. Using ClampingScrollSimulation and increase the friction, .03 or .045 it still feels like the deceleration curve is just off. Apologies for the terms like "slippy", best I can describe it. |
I can confirm this. Android native scrolling behaves different to what flutter is generating. |
I think it was fixed with #77497 |
This came up today. Is it worth landing the test from https://github.com/flutter/flutter/pull/92338/files even if it's marked as failing for now? |
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 |
The PR that closed this is being reverted. Reopening. |
For the next crack at solving this, this reproduction should be included as a test case: #110340 Also, the latest attempt included creating and passing updated FixedScrollMetrics to createBallisticScrollAnimation. This was a breaking change for customers with their own custom scroll physics that expect a scroll position be provided to createBallisticScrollAnimation, not just ScrollMetrics. Either migrating the customer off of this currently safe assumption will be required, or a different approach that preserves that. |
Fixes flutter#120338. Fixes flutter#119875. Fixes flutter#113424. Fixes most of flutter#16371, as the combined symptom of those three. (There's still flutter#120345, and possibly other contributing factors, remaining.) This replaces the implementation of ClampingScrollSimulation with a new version that better matches the Android scroll physics it's intended to match. The new implementation is a version of the Android curve which has been adjusted so that it behaves in a physically reasonable way, in order to satisfy an invariant which the Flutter scroll protocol relies on. Because the old ClampingScrollSimulation didn't satisfy that invariant either, it suffered from a bug (flutter#120338) where restarting the simulation with new metrics would have the side effect of adding friction, making a fling go about 15% less far. So this fixes flutter#120338. The new implementation also goes the same total distance as the Android scroll physics, whereas the existing version would go about 7% less far (stacking with the 15% reduction when the other issue was triggered.) That fixes flutter#119875. Finally, the new implementation comes to a smooth stop, like Android does, whereas the existing version would speed slightly up before abruptly stopping. That fixes flutter#113424. The new implementation's curve is the unique curve that both goes the same total distance as Android's for every possible starting velocity, and meets the Flutter scroll protocol's ballistic invariant. So in that sense this is the canonical way of fixing up the Android behavior to something physically reasonable, or something that works correctly in Flutter.
@Piinks What's the status of this issue currently? The scrolling performance I see is very similar currently. Though the device I am using is an older one so I'm not confident closing this issue based on that. |
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 |
Steps to Reproduce
1, Scroll a ListView page on Android.
2, Observe and compare the scrolls between Flutter and Native pages.
3, The scroll is tiny bumpy in Flutter. Besides, before the end of scroll, I have a feeling that it "suddenly" stops.
screenrecord_20180409_213143.mp4.zip
Flutter Doctor
[✓] Flutter (Channel beta, v0.2.3, on Mac OS X 10.12.6 16G1314, locale zh-Hans-HK)
• Flutter version 0.2.3 at /Users/guoyou/projects/flutter
• Framework revision 5a58b36 (4 weeks ago), 2018-03-13 13:20:13 -0700
• Engine revision e61bb9a
• Dart version 2.0.0-dev.35.flutter-290c576264
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /Users/guoyou/Library/Android/sdk
• Android NDK at /Users/guoyou/Library/Android/sdk/ndk-bundle
• Platform android-27, build-tools 27.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.2, Build version 9C40b
• ios-deploy 1.9.2
• CocoaPods version 1.4.0
[✓] Android Studio (version 3.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
[✓] IntelliJ IDEA Community Edition (version 2017.2.3)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin installed
• Dart plugin version 172.3968.27
[✓] Connected devices (1 available)
• iPhone X • 8D4A21F9-E417-43CE-8B40-52CEAB6B7D04 • ios • iOS 11.2 (simulator)
• No issues found!
The text was updated successfully, but these errors were encountered: