@@ -135,21 +135,34 @@ class _ScrollServiceWidgetState extends State<ScrollServiceWidget>
135135 final endTouchPoint = targetRect.centerRight;
136136
137137 if (PlatformExtension .isMobile) {
138+ // Determine if this is a drag operation
139+ final bool isDragOperation = dragMode != null &&
140+ (dragMode.toString () ==
141+ 'MobileSelectionDragMode.leftSelectionHandle' ||
142+ dragMode.toString () ==
143+ 'MobileSelectionDragMode.rightSelectionHandle' );
144+
145+ // Use animation for drag operations, instant for others
146+ final scrollDuration =
147+ isDragOperation ? const Duration (milliseconds: 2 ) : Duration .zero;
148+
138149 // soft keyboard
139150 // workaround: wait for the soft keyboard to show up
140- final duration = KeyboardHeightObserver .currentKeyboardHeight == 0
151+ final keyboardDelay = KeyboardHeightObserver .currentKeyboardHeight == 0
141152 ? const Duration (milliseconds: 250 )
142153 : Duration .zero;
143154
144- Future .delayed (duration , () {
155+ Future .delayed (keyboardDelay , () {
145156 if (_forwardKey.currentContext == null ) {
146157 return ;
147158 }
159+ // Mobile needs to continuously update scroll position/direction during drag
160+ // Don't skip even if already scrolling, because direction may have changed
148161 startAutoScroll (
149162 endTouchPoint,
150163 edgeOffset: editorState.autoScrollEdgeOffset,
151164 direction: direction,
152- duration: Duration .zero ,
165+ duration: scrollDuration ,
153166 );
154167 });
155168 } else {
0 commit comments