@@ -384,10 +384,28 @@ class MessageListScrollPosition extends ScrollPositionWithSingleContext {
384384 /// at the start of the animation, even if that ends up being more or less far
385385 /// than the actual extent of the content.
386386 void scrollToEnd () {
387+ /// The top speed to move at, in logical pixels per second.
388+ ///
389+ /// This will be the speed whenever the distance to be traveled
390+ /// is long enough to take at least [minDuration] at this speed.
391+ ///
392+ /// This is chosen to equal the top speed that can be produced
393+ /// by a fling gesture in a Flutter [ScrollView] ,
394+ /// which in turn was chosen to equal the top speed of
395+ /// an (initial) fling gesture in a native Android scroll view.
396+ const double topSpeed = 8000 ;
397+
398+ /// The desired duration of the animation when traveling short distances.
399+ ///
400+ /// The speed will be chosen so that traveling the distance
401+ /// will take this long, whenever that distance is short enough
402+ /// that that means a speed of at most [topSpeed] .
403+ const minDuration = Duration (milliseconds: 300 );
404+
387405 final target = maxScrollExtent;
388406 final distance = target - pixels;
389- final durationMsAtSpeedLimit = (1000 * distance / 8000 ).ceil ();
390- final durationMs = math.max (300 , durationMsAtSpeedLimit);
407+ final durationMsAtSpeedLimit = (1000 * distance / topSpeed ).ceil ();
408+ final durationMs = math.max (minDuration.inMilliseconds , durationMsAtSpeedLimit);
391409 animateTo (
392410 target,
393411 duration: Duration (milliseconds: durationMs),
0 commit comments