@@ -85,10 +85,6 @@ class SpinBox extends BaseSpinBox {
8585 this .afterChange,
8686 this .focusNode,
8787 }) : assert (min <= max),
88- assert (decoration? .prefixIcon == null ,
89- 'InputDecoration.prefixIcon is reserved for SpinBox decrement icon' ),
90- assert (decoration? .suffixIcon == null ,
91- 'InputDecoration.suffixIcon is reserved for SpinBox increment icon' ),
9288 keyboardType = keyboardType ??
9389 TextInputType .numberWithOptions (
9490 signed: min < 0 ,
@@ -353,15 +349,30 @@ class _SpinBoxState extends BaseSpinBoxState<SpinBox> {
353349 decoration.disabledBorder != null ||
354350 decoration.focusedErrorBorder != null ;
355351
352+ Widget buildIcon (
353+ Icon icon, {
354+ Widget ? prefix,
355+ Widget ? suffix,
356+ }) {
357+ return Row (
358+ mainAxisSize: MainAxisSize .min,
359+ children: [
360+ if (suffix != null ) suffix,
361+ if (isHorizontal && widget.showButtons)
362+ Padding (
363+ padding: EdgeInsets .symmetric (horizontal: widget.spacing),
364+ child: Icon (null , size: icon.size),
365+ ),
366+ if (prefix != null ) prefix,
367+ ],
368+ );
369+ }
370+
356371 final inputDecoration = decoration.copyWith (
357372 border: ! hasAnyBorder ? const OutlineInputBorder () : decoration.border,
358373 errorText: errorText,
359- prefix: isHorizontal && widget.showButtons
360- ? Icon (null , size: widget.decrementIcon.size)
361- : null ,
362- suffix: isHorizontal && widget.showButtons
363- ? Icon (null , size: widget.incrementIcon.size)
364- : null ,
374+ prefix: buildIcon (widget.decrementIcon, prefix: decoration.prefix),
375+ suffix: buildIcon (widget.incrementIcon, suffix: decoration.suffix),
365376 );
366377
367378 final textField = CallbackShortcuts (
@@ -418,14 +429,20 @@ class _SpinBoxState extends BaseSpinBoxState<SpinBox> {
418429 bottom: bottom,
419430 child: Align (
420431 alignment: Alignment .centerLeft,
421- child: decrementButton,
432+ child: Padding (
433+ padding: EdgeInsets .symmetric (horizontal: widget.spacing),
434+ child: decrementButton,
435+ ),
422436 ),
423437 ),
424438 Positioned .fill (
425439 bottom: bottom,
426440 child: Align (
427441 alignment: Alignment .centerRight,
428- child: incrementButton,
442+ child: Padding (
443+ padding: EdgeInsets .symmetric (horizontal: widget.spacing),
444+ child: incrementButton,
445+ ),
429446 ),
430447 )
431448 ],
0 commit comments