@@ -49,7 +49,7 @@ import 'spin_button.dart';
49
49
class SpinBox extends BaseSpinBox {
50
50
/// Creates a spinbox.
51
51
SpinBox ({
52
- Key ? key,
52
+ super . key,
53
53
this .min = 0 ,
54
54
this .max = 100 ,
55
55
this .step = 1 ,
@@ -95,8 +95,7 @@ class SpinBox extends BaseSpinBox {
95
95
),
96
96
enabled = (enabled ?? true ) && min < max,
97
97
incrementIcon = incrementIcon ?? const Icon (Icons .add),
98
- decrementIcon = decrementIcon ?? const Icon (Icons .remove),
99
- super (key: key);
98
+ decrementIcon = decrementIcon ?? const Icon (Icons .remove);
100
99
101
100
/// The minimum value the user can enter.
102
101
///
@@ -194,7 +193,7 @@ class SpinBox extends BaseSpinBox {
194
193
///
195
194
/// If `null` , then the value of [SpinBoxThemeData.iconColor] is used. If
196
195
/// that is also `null` , then pre-defined defaults are used.
197
- final MaterialStateProperty <Color ?>? iconColor;
196
+ final WidgetStateProperty <Color ?>? iconColor;
198
197
199
198
/// Whether the increment and decrement buttons are shown.
200
199
///
@@ -281,14 +280,10 @@ class SpinBoxState extends State<SpinBox> with SpinBoxMixin {
281
280
if (! widget.enabled) return theme.disabledColor;
282
281
if (hasFocus && errorText == null ) return theme.colorScheme.primary;
283
282
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
+ };
292
287
}
293
288
294
289
double _textHeight (String ? text, TextStyle style) {
@@ -318,19 +313,19 @@ class SpinBoxState extends State<SpinBox> with SpinBoxMixin {
318
313
319
314
final iconColor = widget.iconColor ??
320
315
spinBoxTheme? .iconColor ??
321
- MaterialStateProperty .all (_iconColor (theme, errorText));
316
+ WidgetStateProperty .all (_iconColor (theme, errorText));
322
317
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,
327
322
};
328
323
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);
331
326
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);
334
329
335
330
var bottom = 0.0 ;
336
331
final isHorizontal = widget.direction == Axis .horizontal;
0 commit comments