Skip to content

Commit 7d1d24a

Browse files
committed
chore(deps): upgrade flutter & dart and apply dart fix
1 parent d7dce29 commit 7d1d24a

13 files changed

+54
-60
lines changed

example/lib/main.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ class VerticalSpinBoxPage extends StatelessWidget {
119119
textStyle: TextStyle(fontSize: 48),
120120
incrementIcon: Icon(Icons.keyboard_arrow_up, size: 64),
121121
decrementIcon: Icon(Icons.keyboard_arrow_down, size: 64),
122-
iconColor: MaterialStateProperty.resolveWith((states) {
123-
if (states.contains(MaterialState.disabled)) {
122+
iconColor: WidgetStateProperty.resolveWith((states) {
123+
if (states.contains(WidgetState.disabled)) {
124124
return Colors.grey;
125125
}
126-
if (states.contains(MaterialState.error)) {
126+
if (states.contains(WidgetState.error)) {
127127
return Colors.red;
128128
}
129-
if (states.contains(MaterialState.focused)) {
129+
if (states.contains(WidgetState.focused)) {
130130
return Colors.blue;
131131
}
132132
return Colors.black;

lib/flutter_spinbox.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
///
4545
/// SpinBox for Flutter comes in two variants. It provides implementations for
4646
/// both designs in Flutter, Material and Cupertino (iOS).
47-
library flutter_spinbox;
47+
library;
4848

4949
export 'cupertino.dart';
5050
export 'material.dart';

lib/src/base_spin_box.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import 'spin_formatter.dart';
2828
// ignore_for_file: public_member_api_docs
2929

3030
abstract class BaseSpinBox extends StatefulWidget {
31-
const BaseSpinBox({Key? key}) : super(key: key);
31+
const BaseSpinBox({super.key});
3232

3333
double get min;
3434
double get max;

lib/src/cupertino/spin_box.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ part 'third_party/default_rounded_border.dart';
4848
class CupertinoSpinBox extends BaseSpinBox {
4949
/// Creates a spinbox.
5050
CupertinoSpinBox({
51-
Key? key,
51+
super.key,
5252
this.min = 0,
5353
this.max = 100,
5454
this.step = 1,
@@ -96,8 +96,7 @@ class CupertinoSpinBox extends BaseSpinBox {
9696
incrementIcon =
9797
incrementIcon ?? const Icon(CupertinoIcons.plus_circled),
9898
decrementIcon =
99-
decrementIcon ?? const Icon(CupertinoIcons.minus_circled),
100-
super(key: key);
99+
decrementIcon ?? const Icon(CupertinoIcons.minus_circled);
101100

102101
/// The minimum value the user can enter.
103102
///

lib/src/cupertino/spin_button.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ const double kSpinPadding = 16;
3030

3131
class CupertinoSpinButton extends StatelessWidget {
3232
const CupertinoSpinButton({
33-
Key? key,
33+
super.key,
3434
required this.icon,
3535
this.color,
3636
this.enabled = true,
3737
required this.step,
3838
this.acceleration,
3939
required this.interval,
4040
required this.onStep,
41-
}) : super(key: key);
41+
});
4242

4343
final Icon icon;
4444
final Color? color;

lib/src/material/spin_box.dart

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import 'spin_button.dart';
4949
class 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;

lib/src/material/spin_box_theme.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ class SpinBoxThemeData with Diagnosticable {
2323
/// The color to use for [SpinBox.incrementIcon] and [SpinBox.decrementIcon].
2424
///
2525
/// Resolves in the following states:
26-
/// * [MaterialState.focused].
27-
/// * [MaterialState.disabled].
28-
/// * [MaterialState.error].
26+
/// * [WidgetState.focused].
27+
/// * [WidgetState.disabled].
28+
/// * [WidgetState.error].
2929
///
3030
/// If specified, overrides the default value of [SpinBox.iconColor].
31-
final MaterialStateProperty<Color?>? iconColor;
31+
final WidgetStateProperty<Color?>? iconColor;
3232

3333
/// See [TextField.decoration].
3434
///
@@ -39,7 +39,7 @@ class SpinBoxThemeData with Diagnosticable {
3939
/// new values.
4040
SpinBoxThemeData copyWith({
4141
double? iconSize,
42-
MaterialStateProperty<Color?>? iconColor,
42+
WidgetStateProperty<Color?>? iconColor,
4343
InputDecoration? decoration,
4444
}) {
4545
return SpinBoxThemeData(
@@ -73,7 +73,7 @@ class SpinBoxThemeData with Diagnosticable {
7373
),
7474
);
7575
properties.add(
76-
DiagnosticsProperty<MaterialStateProperty<Color?>>(
76+
DiagnosticsProperty<WidgetStateProperty<Color?>>(
7777
'iconColor',
7878
iconColor,
7979
defaultValue: null,
@@ -103,10 +103,10 @@ class SpinBoxTheme extends InheritedWidget {
103103
/// Constructs a checkbox theme that configures all descendant [SpinBox]
104104
/// widgets.
105105
const SpinBoxTheme({
106-
Key? key,
106+
super.key,
107107
required this.data,
108-
required Widget child,
109-
}) : super(key: key, child: child);
108+
required super.child,
109+
});
110110

111111
/// The properties used for all descendant [SpinBox] widgets.
112112
final SpinBoxThemeData data;

lib/src/material/spin_button.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import '../spin_gesture.dart';
2828

2929
class SpinButton extends StatelessWidget {
3030
const SpinButton({
31-
Key? key,
31+
super.key,
3232
required this.icon,
3333
this.iconSize,
3434
this.color,
@@ -37,7 +37,7 @@ class SpinButton extends StatelessWidget {
3737
this.acceleration,
3838
required this.interval,
3939
required this.onStep,
40-
}) : super(key: key);
40+
});
4141

4242
final Icon icon;
4343
final double? iconSize;

lib/src/spin_gesture.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ import 'package:flutter/material.dart';
2828

2929
class SpinGesture extends StatefulWidget {
3030
const SpinGesture({
31-
Key? key,
31+
super.key,
3232
this.enabled = true,
3333
required this.child,
3434
required this.step,
3535
this.acceleration,
3636
required this.interval,
3737
required this.onStep,
38-
}) : super(key: key);
38+
});
3939

4040
final bool enabled;
4141
final Widget child;

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ repository: https://github.com/jpnurmi/flutter_spinbox
88
issue_tracker: https://github.com/jpnurmi/flutter_spinbox/issues
99

1010
environment:
11-
sdk: ">=2.14.0 <4.0.0"
12-
flutter: ">=3.7.0"
11+
sdk: ">=3.6.0 <4.0.0"
12+
flutter: ">=3.27.0"
1313

1414
dependencies:
1515
cupertino_icons: ^1.0.2

0 commit comments

Comments
 (0)