@@ -54,31 +54,34 @@ mixin SpinBoxMixin<T extends BaseSpinBox> on State<T> {
54
54
FocusNode get focusNode => _focusNode;
55
55
SpinFormatter get formatter => SpinFormatter (_controller);
56
56
57
- String _formatValue (double value) {
58
- return formatter.formatValue (value,
59
- decimals: widget.decimals, digits: widget.digits);
60
- }
61
-
62
57
Map <ShortcutActivator , VoidCallback > get bindings {
63
58
return {
64
59
// ### TODO: use SingleActivator fixed in Flutter 2.10+
65
60
// 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 ,
70
65
};
71
66
}
72
67
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
+
73
78
@override
74
79
void initState () {
75
80
super .initState ();
76
81
_controller = widget.controller ??
77
82
SpinController (
78
83
min: widget.min,
79
84
max: widget.max,
80
- step: widget.step,
81
- pageStep: widget.pageStep,
82
85
value: widget.value,
83
86
decimals: widget.decimals,
84
87
);
0 commit comments