Skip to content

[IOS] BouncingScrollPhysics too 'slippery' #103762

Open

Description

@LucasAschenbach

Current Behavior

The current implementation of BouncingScrollPhysics feels somewhat 'slippery' when compared to the native iOS scroll physics. I tested the scroll behavior with the scroll_overlay app and made the following observations:

  • iOS only triggers a ScrollSimulation when it's velocity is > 83.0
  • iOS friction simulation uses more friction
  • iOS friction simulation is started at a slightly lower velocity
  • iOS velocity acceleration (carriedMomentum) for accumulated scrolling significantly stronger than in Flutter. I was able to scroll to the end of the native list while the Flutter list barely made it to ListTile no. 400.
  • Overscroll bounce simulation in iOS is exponential, not logistic as in the current implementation of BouncingScrollSimulation

Note: It seems that the iOS platform view exposes the scroll velocity in a larger unit

Quick Fix

  • Decrease FrictionSimulation drag to 0.126
  • Increase minFlingVelocity to 241.0

These changes will not mimic the iOS behavior perfectly but address the scroll fidelity to a degree that makes for an overall noticeably improved scrolling experience. Perhaps, also adding a configuration option for a fast and a normal deceleration rate as in the UIScrollView class from UIKit might be a way to go.

I'm not sure whether these changes should be added to the Framework provisionally or if you would like to wait for a more permanent solution to fix the issue. I mainly wanted to spark a conversation about the iOS scrolling physics in Flutter, as, while the differences are subtle, they are still noticeable in specific scenarios.

Activity

  1. maheshj01 commented on May 16, 2022

    @maheshj01
    Member

    Hi @LucasAschenbach, Thanks for filing the issue. Would it be possible for you to show the "slippery" bouncing effect in comparison with a native IOS app (in the form of video) to understand it better? Please also share the output of flutter doctor -v.

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on May 16, 2022
  3. LucasAschenbach commented on May 16, 2022

    @LucasAschenbach
    Author

    The following screen recordings capture the screen_overlay app and the default physics configurations.

    Friction and Bounce Minimum Fling Velocity Carried Momentum
    RPReplay_Final1652707649.MP4
    RPReplay_Final1652708118.MP4
    RPReplay_Final1652708168.MP4

    This is the version with the modifications as specified above:

    RPReplay_Final1652707124.MP4

    I just noticed that the physics seem to be slightly different for up and down scrolling. When scrolling down, the modified values are closer to the native physics, however, when scrolling up, the current parameters seem to be a better fit. However, clearly, changing the parameters will only do so much as the underlying physics implementations seem to be different.

    As for the suggested temporary fixes: in my apps I reverted the friction ratio back to its initial value of 0.135 as a value of 0.126 made reverse scrolling feel too slow and it was mainly the unwanted flings which were tripping off the scrolling experience.


    Flutter Doctor:

    [✓] Flutter (Channel stable, 3.0.0, on macOS 12.3.1 21E258 darwin-arm,
        locale en-US)
        • Flutter version 3.0.0 at
          /Users/lucasaschenbach/Developer/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision ee4e09cce0 (7 days ago), 2022-05-09 16:45:18
          -0700
        • Engine revision d1b9a6938a
        • Dart version 2.17.0
        • DevTools version 2.12.2
    
    [✓] Android toolchain - develop for Android devices (Android SDK
        version 31.0.0)
        • Android SDK at /Users/lucasaschenbach/Library/Android/sdk
        • Platform android-31, build-tools 31.0.0
        • Java binary at: /Applications/Android
          Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build
          11.0.11+0-b60-7772763)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google
          Chrome
    
    [✓] Android Studio (version 2021.1)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build
          11.0.11+0-b60-7772763)
    
    [✓] VS Code (version 1.67.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.40.0
    
    [✓] Connected device (3 available)
        • Lucas‘s iPhone 12 Pro (mobile) • 00008101-000229C136F1003A • ios
          • iOS 15.4.1 19E258
        • macOS (desktop)                • macos                     •
          darwin-arm64   • macOS 12.3.1 21E258 darwin-arm
        • Chrome (web)                   • chrome                    •
          web-javascript • Google Chrome 101.0.4951.64
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
    
  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on May 16, 2022
  5. maheshj01 commented on May 17, 2022

    @maheshj01
    Member

    Thanks for the info @LucasAschenbach, Labeling this issue as a proposal to improve BouncingScrollPhysics to match the native platforms.

  6. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    f: scrollingViewports, list views, slivers, etc.
    c: proposalA detailed proposal for a change to Flutter
    a: fidelityMatching the OEM platforms better
    platform-iosiOS applications specifically
    and removed
    in triagePresently being triaged by the triage team
    on May 17, 2022
  7. changed the title [-]BouncingScrollPhysics too 'slippery'[/-] [+][IOS] BouncingScrollPhysics too 'slippery'[/+] on May 17, 2022
  8. added
    P2Important issues not at the top of the work list
    on May 18, 2022
  9. added
    fyi-iosFor the attention of iOS platform team
    and removed
    team-iosOwned by iOS platform team
    on Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: fidelityMatching the OEM platforms betterc: proposalA detailed proposal for a change to Flutterf: scrollingViewports, list views, slivers, etc.frameworkflutter/packages/flutter repository. See also f: labels.platform-iosiOS applications specificallyteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions