Open RahulEncodework opened 1 year ago
I wanted the same thing. My workaround is to listen to UserScrollNotification
and only call onChanged
when the scroll direction is "idle". Solution below uses flutter hooks but could also be done with a stateful widget.
```dart
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:numberpicker/numberpicker.dart';
class MyNumberPicker extends HookConsumerWidget {
/// Min value user can pick
final int minValue;
// ... all other fields
const MyNumberPicker({
Key? key,
required this.minValue,
// ... all other fields
}) : super(key: key);
@override
Widget build(BuildContext context, WidgetRef ref) {
final temp = useState(value);
return NotificationListener
onChange called when the user stops changing the value