When I pick a new value with the NumberPicker, it always jumps back to the previous value and not to the current chosen value.
I am using the NumberPicker within AlertDialog and I call the NumberPicker with the pickValue() function.
void pickValue() {
showDialog<int>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text("Wähle eine Aufgabenanzahl"),
content: NumberPicker(
selectedTextStyle: TextStyle(color: Colors.red),
value: currentValue,
minValue: 1,
maxValue: 10,
onChanged: (value) => setState(() => currentValue = value),
),
actions: [
TextButton(
child: Text("OK", style: TextStyles.body),
onPressed: () {
Navigator.of(context).pop();
},
)
],
);
});
}