From 6af0559d4534613820a8be0a2034fa7878122fe2 Mon Sep 17 00:00:00 2001 From: "Vadims Casecnikovs (Vadim Chashechnikov)" Date: Tue, 8 Feb 2022 16:29:38 +0200 Subject: [PATCH] This fixes infinite loop in my project --- lib/src/numberpicker.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/src/numberpicker.dart b/lib/src/numberpicker.dart index 63b97a1..8dabcce 100644 --- a/lib/src/numberpicker.dart +++ b/lib/src/numberpicker.dart @@ -104,8 +104,6 @@ class _NumberPickerState extends State { var indexOfMiddleElement = (_scrollController.offset / itemExtent).round(); if (widget.infiniteLoop) { indexOfMiddleElement %= itemCount; - } else { - indexOfMiddleElement = indexOfMiddleElement.clamp(0, itemCount - 1); } final intValueInTheMiddle = _intValueFromIndex(indexOfMiddleElement + additionalItemsOnEachSide);