File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ abstract class BaseSpinBox extends StatefulWidget {
3737 double get value;
3838 int get decimals;
3939 int get digits;
40+ void Function (double )? get onSubmitted;
4041 ValueChanged <double >? get onChanged;
4142 bool Function (double value)? get canChange;
4243 VoidCallback ? get beforeChange;
@@ -127,6 +128,7 @@ mixin SpinBoxMixin<T extends BaseSpinBox> on State<T> {
127128
128129 widget.beforeChange? .call ();
129130 setState (() => _updateController (value, newValue));
131+ widget.onSubmitted? .call (double .parse (_formatText (newValue)));
130132 widget.afterChange? .call ();
131133 }
132134
Original file line number Diff line number Diff line change @@ -256,7 +256,12 @@ class CupertinoSpinBox extends BaseSpinBox {
256256 /// See [CupertinoTextField.toolbarOptions] .
257257 final ToolbarOptions ? toolbarOptions;
258258
259- /// See [CupertinoTextField.onSubmitted] . Is called with a formatted value.
259+ /// See [TextField.onSubmitted] .
260+ ///
261+ /// Is also called when an increment or decrement button is pressed.
262+ ///
263+ /// Value is formatted.
264+ @override
260265 final void Function (double )? onSubmitted;
261266
262267 @override
Original file line number Diff line number Diff line change @@ -264,7 +264,12 @@ class SpinBox extends BaseSpinBox {
264264 /// See [TextField.toolbarOptions] .
265265 final ToolbarOptions ? toolbarOptions;
266266
267- /// See [TextField.onSubmitted] . Is called with a formatted value.
267+ /// See [TextField.onSubmitted] .
268+ ///
269+ /// Is also called when an increment or decrement button is pressed.
270+ ///
271+ /// Value is formatted.
272+ @override
268273 final void Function (double )? onSubmitted;
269274
270275 @override
You can’t perform that action at this time.
0 commit comments