@@ -49,7 +49,7 @@ import 'spin_button.dart';
4949class SpinBox extends BaseSpinBox {
5050 /// Creates a spinbox.
5151 SpinBox ({
52- Key ? key,
52+ super . key,
5353 this .min = 0 ,
5454 this .max = 100 ,
5555 this .step = 1 ,
@@ -95,8 +95,7 @@ class SpinBox extends BaseSpinBox {
9595 ),
9696 enabled = (enabled ?? true ) && min < max,
9797 incrementIcon = incrementIcon ?? const Icon (Icons .add),
98- decrementIcon = decrementIcon ?? const Icon (Icons .remove),
99- super (key: key);
98+ decrementIcon = decrementIcon ?? const Icon (Icons .remove);
10099
101100 /// The minimum value the user can enter.
102101 ///
@@ -194,7 +193,7 @@ class SpinBox extends BaseSpinBox {
194193 ///
195194 /// If `null` , then the value of [SpinBoxThemeData.iconColor] is used. If
196195 /// that is also `null` , then pre-defined defaults are used.
197- final MaterialStateProperty <Color ?>? iconColor;
196+ final WidgetStateProperty <Color ?>? iconColor;
198197
199198 /// Whether the increment and decrement buttons are shown.
200199 ///
@@ -281,14 +280,10 @@ class SpinBoxState extends State<SpinBox> with SpinBoxMixin {
281280 if (! widget.enabled) return theme.disabledColor;
282281 if (hasFocus && errorText == null ) return theme.colorScheme.primary;
283282
284- switch (theme.brightness) {
285- case Brightness .dark:
286- return Colors .white70;
287- case Brightness .light:
288- return Colors .black45;
289- default :
290- return theme.iconTheme.color;
291- }
283+ return switch (theme.brightness) {
284+ Brightness .dark => Colors .white70,
285+ Brightness .light => Colors .black45,
286+ };
292287 }
293288
294289 double _textHeight (String ? text, TextStyle style) {
@@ -318,19 +313,19 @@ class SpinBoxState extends State<SpinBox> with SpinBoxMixin {
318313
319314 final iconColor = widget.iconColor ??
320315 spinBoxTheme? .iconColor ??
321- MaterialStateProperty .all (_iconColor (theme, errorText));
316+ WidgetStateProperty .all (_iconColor (theme, errorText));
322317
323- final states = < MaterialState > {
324- if (! widget.enabled) MaterialState .disabled,
325- if (hasFocus) MaterialState .focused,
326- if (errorText != null ) MaterialState .error,
318+ final states = < WidgetState > {
319+ if (! widget.enabled) WidgetState .disabled,
320+ if (hasFocus) WidgetState .focused,
321+ if (errorText != null ) WidgetState .error,
327322 };
328323
329- final decrementStates = Set <MaterialState >.of (states);
330- if (value <= widget.min) decrementStates.add (MaterialState .disabled);
324+ final decrementStates = Set <WidgetState >.of (states);
325+ if (value <= widget.min) decrementStates.add (WidgetState .disabled);
331326
332- final incrementStates = Set <MaterialState >.of (states);
333- if (value >= widget.max) incrementStates.add (MaterialState .disabled);
327+ final incrementStates = Set <WidgetState >.of (states);
328+ if (value >= widget.max) incrementStates.add (WidgetState .disabled);
334329
335330 var bottom = 0.0 ;
336331 final isHorizontal = widget.direction == Axis .horizontal;
0 commit comments