Repository: flutter
Issue: CupertinoPicker Infinity or NaN toInt '_drag == null': is not true.
Labels: framework,f: scrolling,a: error message,has reproducible steps,P3,team-design,triaged-design,found in release: 3.22,found in release: 3.23

### Steps to reproduce

1. Create a simple view with a cupertinoPicker widget (_attached code in code sample section_)
2. Try scrolling through the values a couple of times in a row

### Expected results

The expected result is to be able to scroll the selector and get a smooth change, without getting stuck on any value

### Actual results

The current result is that when scrolling in the cupertino picker widget, after having scrolled a couple of times, it stops at a value

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class Cupertino extends StatefulWidget {
  const Cupertino({super.key});

  @override
  State<Cupertino> createState() => _CupertinoState();
}

class _CupertinoState extends State<Cupertino> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: SizedBox(
          height: 300,
          child: CupertinoPicker(
            backgroundColor: Colors.white,
            itemExtent: 32.0,
            onSelectedItemChanged: (int index) {},
            children: List<Widget>.generate(150, (int index) {
              return Center(
                child: Text(' $index'),
              );
            }),
          ),
        ),
      ),
    );
  }
}

```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>


https://github.com/flutter/flutter/assets/91835403/bb9fbe2d-432c-4c9d-ba3b-04daf3f9d725



</details>


### Logs

<details open><summary>Logs</summary>

```console
flutter: ══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
flutter: The following UnsupportedError was thrown while handling a gesture:
flutter: Unsupported operation: Infinity or NaN toInt
flutter: 
flutter: When the exception was thrown, this was the stack:
flutter: #0      double.toInt (dart:core-patch/double.dart)
flutter: #1      double.round (dart:core-patch/double.dart:194:34)
flutter: #2      _getItemFromOffset (package:flutter/src/widgets/list_wheel_scroll_view.dart:352:96)
flutter: #3      FixedExtentScrollPhysics.createBallisticSimulation (package:flutter/src/widgets/list_wheel_scroll_view.dart:500:35)
flutter: #4      ScrollPositionWithSingleContext.goBallistic (package:flutter/src/widgets/scroll_position_with_single_context.dart:144:44)
flutter: #5      ScrollDragController.end (package:flutter/src/widgets/scroll_activity.dart:439:14)
flutter: #6      ScrollableState._handleDragEnd (package:flutter/src/widgets/scrollable.dart:845:12)
flutter: #7      DragGestureRecognizer._checkEnd.<anonymous closure> (package:flutter/src/gestures/monodrag.dart:605:47)
flutter: #8      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:315:24)
flutter: #9      DragGestureRecognizer._checkEnd (package:flutter/src/gestures/monodrag.dart:605:5)
flutter: #10     DragGestureRecognizer.didStopTrackingLastPointer (package:flutter/src/gestures/monodrag.dart:483:9)
flutter: #11     OneSequenceGestureRecognizer.stopTrackingPointer (package:flutter/src/gestures/recognizer.dart:505:9)
flutter: #12     DragGestureRecognizer._giveUpPointer (package:flutter/src/gestures/monodrag.dart:492:5)
flutter: #13     DragGestureRecognizer.handleEvent (package:flutter/src/gestures/monodrag.dart:451:7)
flutter: #14     PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:98:12)
flutter: #15     PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:143:9)
flutter: #16     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:633:13)
flutter: #17     PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:141:18)
flutter: #18     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:127:7)
flutter: #19     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:495:19)
flutter: #20     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:475:22)
flutter: #21     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:430:11)
flutter: #22     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:420:7)
flutter: #23     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:383:5)
flutter: #24     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:330:7)
flutter: #25     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:299:9)
flutter: #26     _invoke1 (dart:ui/hooks.dart:328:13)
flutter: #27     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:429:7)
flutter: #28     _dispatchPointerDataPacket (dart:ui/hooks.dart:262:31)
flutter: 
flutter: Handler: "onEnd"
flutter: Recognizer:
flutter:   VerticalDragGestureRecognizer#dcb00
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
flutter: Another exception was thrown: 'package:flutter/src/widgets/scrollable.dart': Failed assertion: line 821 pos 12: '_drag == null': is not true.
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[!] Flutter (Channel [user-branch], 3.19.6, on macOS 14.3.1 23D60 darwin-arm64, locale es-ES)
    ! Flutter version 3.19.6 on channel [user-branch] at /Users/irene/development/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
    • Framework revision 54e66469a9 (7 weeks ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/irene/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.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 17.0.7+0-17.0.7b1000.6-10550314)

[✓] VS Code (version 1.86.2)
    • VS Code at /Users/irene/Downloads/Visual Studio Code.app/Contents
    • Flutter extension version 3.90.0

[✓] Connected device (4 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554             • android-arm64  • Android 14 (API 34) (emulator)
    • iPhone irene (mobile)       • 00008110-000575DE0A39401E • ios            • iOS 17.3.1 21D61
    • macOS (desktop)             • macos                     • darwin-arm64   • macOS 14.3.1 23D60 darwin-arm64
    • Chrome (web)                • chrome                    • web-javascript • Google Chrome 125.0.6422.114

[✓] Network resources
    • All expected network resources are available.
```

</details>