Mobile Development 11 min read

Optimizing Flutter Scroll Curve and Performance for Xianyu

Xianyu's team optimized Flutter's scrolling by fixing fling restarts, replacing the default Clamping simulation with Android's Scroller formula, and adding a velocity‑based deceleration curve, resulting in native‑like smoothness and reduced dropped frames, now shipped behind feature flags and evaluated in A/B tests.

Xianyu Technology
Xianyu Technology
Xianyu Technology
Optimizing Flutter Scroll Curve and Performance for Xianyu

Since adopting Flutter, Xianyu has faced smoothness issues, especially the scroll experience compared to native. Over the past six months the team worked on flattening the scroll experience, aiming to align Flutter’s scrolling with native.

The work is divided into two parts: (1) optimizing the scroll curve to match the feel, and (2) improving rendering performance to reduce dropped frames.

To evaluate the scroll curve, platform_tests were used to compare Flutter and native scrolling on Android and iOS. Android showed a noticeably larger damping.

In Android, the default ScrollPhysics.createBallisticSimulation() builds a ClampingScrollSimulation which determines the fling animation. The simulation is derived from simple kinematic formulas, but its derivative is not monotonic, causing a slight “sticky” feeling at the end.

The team discovered that during a fling, a layout change triggers RenderViewport.performLayout() , which calls ScrollPositionWithSingleContext.goBallistic() . This restarts the fling animation, preventing the curve from completing.

Solution: replace the restart with updateBallisticAnimation() that creates a new simulation using the original ScrollMetrics and velocity, while only updating the scroll extents.

After fixing the restart, the Android curve still differed from native. The final step was to replace the Clamping formula with the implementation from Android’s Scroller.java , translated to Dart (PR #77497). The new curve matches native behavior.

However, the new curve felt too fast for some scenarios. The team introduced a deceleration factor by scaling the initial velocity (e.g., multiplying by 0.91) and later refined it with a quadratic function y = a·x² + b·x + c that provides stronger deceleration at medium speeds while preserving the overall shape.

Experiments showed the optimal deceleration peak around 0.7, yielding a smoother experience across fast and slow gestures. The changes have been shipped with feature flags and are being evaluated in A/B tests.

Future work includes merging the two PRs ( fix animation restart , Android curve port ), fine‑tuning the curve with business data, and coupling scroll speed with image loading to further improve perceived smoothness.

FlutterMobile DevelopmentanimationOptimizationscroll performance
Xianyu Technology
Written by

Xianyu Technology

Official account of the Xianyu technology team

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.