@@ -54,31 +54,34 @@ mixin SpinBoxMixin<T extends BaseSpinBox> on State<T> {
5454 FocusNode get focusNode => _focusNode;
5555 SpinFormatter get formatter => SpinFormatter (_controller);
5656
57- String _formatValue (double value) {
58- return formatter.formatValue (value,
59- decimals: widget.decimals, digits: widget.digits);
60- }
61-
6257 Map <ShortcutActivator , VoidCallback > get bindings {
6358 return {
6459 // ### TODO: use SingleActivator fixed in Flutter 2.10+
6560 // https://github.com/flutter/flutter/issues/92717
66- LogicalKeySet (LogicalKeyboardKey .arrowUp): _controller.stepUp ,
67- LogicalKeySet (LogicalKeyboardKey .arrowDown): _controller.stepDown ,
68- LogicalKeySet (LogicalKeyboardKey .pageUp): _controller.pageStepUp ,
69- LogicalKeySet (LogicalKeyboardKey .pageDown): _controller.pageStepDown ,
61+ LogicalKeySet (LogicalKeyboardKey .arrowUp): _stepUp ,
62+ LogicalKeySet (LogicalKeyboardKey .arrowDown): _stepDown ,
63+ LogicalKeySet (LogicalKeyboardKey .pageUp): _pageStepUp ,
64+ LogicalKeySet (LogicalKeyboardKey .pageDown): _pageStepDown ,
7065 };
7166 }
7267
68+ String _formatValue (double value) {
69+ return formatter.formatValue (value,
70+ decimals: widget.decimals, digits: widget.digits);
71+ }
72+
73+ void _stepUp () => controller.value += widget.step;
74+ void _stepDown () => controller.value += - widget.step;
75+ void _pageStepUp () => controller.value += widget.pageStep;
76+ void _pageStepDown () => controller.value -= widget.pageStep;
77+
7378 @override
7479 void initState () {
7580 super .initState ();
7681 _controller = widget.controller ??
7782 SpinController (
7883 min: widget.min,
7984 max: widget.max,
80- step: widget.step,
81- pageStep: widget.pageStep,
8285 value: widget.value,
8386 decimals: widget.decimals,
8487 );
0 commit comments