Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/src/numberpicker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class NumberPicker extends StatefulWidget {
/// Called when selected value changes
final ValueChanged<int> onChanged;

/// Called when user stops dragging
final VoidCallback? onStop;

/// Specifies how many items should be shown - defaults to 3
final int itemCount;

Expand Down Expand Up @@ -62,6 +65,7 @@ class NumberPicker extends StatefulWidget {
required this.maxValue,
required this.value,
required this.onChanged,
this.onStop,
this.itemCount = 3,
this.step = 1,
this.itemHeight = 50,
Expand Down Expand Up @@ -158,6 +162,7 @@ class _NumberPickerState extends State<NumberPicker> {
child: NotificationListener<ScrollEndNotification>(
onNotification: (not) {
if (not.dragDetails?.primaryVelocity == 0) {
widget.onStop?.call();
Future.microtask(() => _maybeCenterValue());
}
return true;
Expand Down