Skip to content

Commit c11a01b

Browse files
committed
feat: click on numbers to change to them (MarcinusX#137)
1 parent 566ab31 commit c11a01b

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

lib/src/numberpicker.dart

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,22 @@ class _NumberPickerState extends State<NumberPicker> {
212212
style: itemStyle,
213213
);
214214

215-
return Container(
216-
width: widget.itemWidth,
217-
height: widget.itemHeight,
218-
alignment: Alignment.center,
219-
child: child,
215+
return InkWell(
216+
onTap: () {
217+
if (!isExtra) {
218+
widget.onChanged(value);
219+
Future.delayed(
220+
const Duration(milliseconds: 100),
221+
() => _maybeCenterValue(),
222+
);
223+
}
224+
},
225+
child: Container(
226+
width: widget.itemWidth,
227+
height: widget.itemHeight,
228+
alignment: Alignment.center,
229+
child: child,
230+
),
220231
);
221232
}
222233

0 commit comments

Comments
 (0)