Skip to content

Commit 2fafad3

Browse files
committed
Update Flutter Lint v2.0.1
1 parent bbc8541 commit 2fafad3

6 files changed

Lines changed: 50 additions & 97 deletions

File tree

lib/responsive_row_column.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,23 +176,23 @@ class ResponsiveRowColumnItem extends StatelessWidget {
176176
}
177177

178178
ResponsiveRowColumnItem copyWith({
179-
Widget? child,
180179
int? rowOrder,
181180
int? columnOrder,
182181
bool? rowColumn,
183182
int? rowFlex,
184183
int? columnFlex,
185184
FlexFit? rowFlexFit,
186185
FlexFit? columnFlexFit,
186+
Widget? child,
187187
}) =>
188188
ResponsiveRowColumnItem(
189-
child: child ?? this.child,
190189
rowOrder: rowOrder ?? this.rowOrder,
191190
columnOrder: columnOrder ?? this.columnOrder,
192191
rowColumn: rowColumn ?? this.rowColumn,
193192
rowFlex: rowFlex ?? this.rowFlex,
194193
columnFlex: columnFlex ?? this.columnFlex,
195194
rowFit: rowFlexFit ?? rowFit,
196195
columnFit: columnFlexFit ?? columnFit,
196+
child: child ?? this.child,
197197
);
198198
}

lib/responsive_value.dart

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,7 @@ class Condition<T> {
192192

193193
@override
194194
String toString() =>
195-
'Condition(' 'breakpoint: ' +
196-
breakpoint.toString() +
197-
', name: ' +
198-
name.toString() +
199-
', condition: ' +
200-
condition.toString() +
201-
', value: ' +
202-
value.toString() +
203-
', landscapeValue: ' +
204-
landscapeValue.toString() +
205-
')';
195+
'Condition(breakpoint: $breakpoint, name: $name, condition: $condition, value: $value, landscapeValue: $landscapeValue)';
206196

207197
int sort(Condition a, Condition b) {
208198
if (a.breakpoint == b.breakpoint) return 0;
@@ -257,14 +247,14 @@ class ResponsiveVisibility extends StatelessWidget {
257247
.value;
258248

259249
return Visibility(
260-
child: child,
261250
replacement: replacement,
262251
visible: visibleValue!,
263252
maintainState: maintainState,
264253
maintainAnimation: maintainAnimation,
265254
maintainSize: maintainSize,
266255
maintainSemantics: maintainSemantics,
267256
maintainInteractivity: maintainInteractivity,
257+
child: child,
268258
);
269259
}
270260
}

lib/responsive_wrapper.dart

Lines changed: 11 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class ResponsiveWrapper extends StatefulWidget {
165165
}) : super(key: key);
166166

167167
@override
168-
_ResponsiveWrapperState createState() => _ResponsiveWrapperState();
168+
ResponsiveWrapperState createState() => ResponsiveWrapperState();
169169

170170
static Widget builder(
171171
Widget? child, {
@@ -190,7 +190,6 @@ class ResponsiveWrapper extends StatefulWidget {
190190
bool debugLog = false,
191191
}) {
192192
return ResponsiveWrapper(
193-
child: child,
194193
breakpoints: breakpoints,
195194
breakpointsLandscape: breakpointsLandscape,
196195
landscapePlatforms: landscapePlatforms,
@@ -211,6 +210,7 @@ class ResponsiveWrapper extends StatefulWidget {
211210
shrinkWrap: false,
212211
alignment: alignment,
213212
debugLog: debugLog,
213+
child: child,
214214
);
215215
}
216216

@@ -232,7 +232,7 @@ class ResponsiveWrapper extends StatefulWidget {
232232
}
233233
}
234234

235-
class _ResponsiveWrapperState extends State<ResponsiveWrapper>
235+
class ResponsiveWrapperState extends State<ResponsiveWrapper>
236236
with WidgetsBindingObserver {
237237
double devicePixelRatio = 1;
238238
double getDevicePixelRatio() {
@@ -619,8 +619,8 @@ class _ResponsiveWrapperState extends State<ResponsiveWrapper>
619619
}
620620

621621
// Dimensions are only available after first frame paint.
622-
WidgetsBinding.instance!.addObserver(this);
623-
WidgetsBinding.instance!.addPostFrameCallback((_) {
622+
WidgetsBinding.instance.addObserver(this);
623+
WidgetsBinding.instance.addPostFrameCallback((_) {
624624
// Breakpoints must be initialized before the first frame is drawn.
625625
setBreakpoints();
626626
// Directly updating dimensions is safe because frame callbacks
@@ -632,7 +632,7 @@ class _ResponsiveWrapperState extends State<ResponsiveWrapper>
632632

633633
@override
634634
void dispose() {
635-
WidgetsBinding.instance!.removeObserver(this);
635+
WidgetsBinding.instance.removeObserver(this);
636636
super.dispose();
637637
}
638638

@@ -642,7 +642,7 @@ class _ResponsiveWrapperState extends State<ResponsiveWrapper>
642642
// When physical dimensions change, update state.
643643
// The required MediaQueryData is only available
644644
// on the next frame for physical dimension changes.
645-
WidgetsBinding.instance!.addPostFrameCallback((_) {
645+
WidgetsBinding.instance.addPostFrameCallback((_) {
646646
// Widget could be destroyed by resize. Verify widget
647647
// exists before updating dimensions.
648648
if (mounted) {
@@ -788,7 +788,7 @@ class ResponsiveWrapperData {
788788

789789
/// Creates data based on the [ResponsiveWrapper] state.
790790
static ResponsiveWrapperData fromResponsiveWrapper(
791-
_ResponsiveWrapperState state) {
791+
ResponsiveWrapperState state) {
792792
return ResponsiveWrapperData(
793793
screenWidth: state.screenWidth,
794794
screenHeight: state.screenHeight,
@@ -810,29 +810,7 @@ class ResponsiveWrapperData {
810810

811811
@override
812812
String toString() =>
813-
'ResponsiveWrapperData(' 'screenWidth: ' +
814-
screenWidth.toString() +
815-
', screenHeight: ' +
816-
screenHeight.toString() +
817-
', scaledWidth: ' +
818-
scaledWidth.toString() +
819-
', scaledHeight: ' +
820-
scaledHeight.toString() +
821-
', breakpoints: ' +
822-
breakpoints.asMap().toString() +
823-
', breakpointSegments: ' +
824-
breakpointSegments.toString() +
825-
', activeBreakpoint: ' +
826-
activeBreakpoint.toString() +
827-
', isMobile: ' +
828-
isMobile.toString() +
829-
', isPhone: ' +
830-
isPhone.toString() +
831-
', isTablet: ' +
832-
isTablet.toString() +
833-
', isDesktop: ' +
834-
isDesktop.toString() +
835-
')';
813+
'ResponsiveWrapperData(screenWidth: $screenWidth, screenHeight: $screenHeight, scaledWidth: $scaledWidth, scaledHeight: $scaledHeight, breakpoints: ${breakpoints.asMap()}, breakpointSegments: $breakpointSegments, activeBreakpoint: $activeBreakpoint, isMobile: $isMobile, isPhone: $isPhone, isTablet: $isTablet, isDesktop: $isDesktop)';
836814

837815
bool equals(String? name) => activeBreakpoint.name == name;
838816

@@ -1015,15 +993,7 @@ class ResponsiveBreakpoint {
1015993

1016994
@override
1017995
String toString() =>
1018-
'ResponsiveBreakpoint(' 'breakpoint: ' +
1019-
breakpoint.toString() +
1020-
', name: ' +
1021-
name.toString() +
1022-
', behavior: ' +
1023-
behavior.toString() +
1024-
', scaleFactor: ' +
1025-
scaleFactor.toString() +
1026-
')';
996+
'ResponsiveBreakpoint(breakpoint: $breakpoint, name: $name, behavior: $behavior, scaleFactor: $scaleFactor)';
1027997

1028998
@override
1029999
bool operator ==(Object other) =>
@@ -1107,13 +1077,7 @@ class ResponsiveBreakpointSegment {
11071077

11081078
@override
11091079
String toString() =>
1110-
'ResponsiveBreakpointSegment(' 'breakpoint: ' +
1111-
breakpoint.toString() +
1112-
', segmentType: ' +
1113-
segmentType.toString() +
1114-
', responsiveBreakpoint: ' +
1115-
responsiveBreakpoint.toString() +
1116-
')';
1080+
'ResponsiveBreakpointSegment(breakpoint: $breakpoint, segmentType: $segmentType, responsiveBreakpoint: $responsiveBreakpoint)';
11171081

11181082
@override
11191083
bool operator ==(Object other) =>

lib/utils/responsive_utils.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,8 @@ class ResponsiveUtils {
6464
stringBuffer.write(' ----- ');
6565
if (segment.segmentType == ResponsiveBreakpointBehavior.AUTOSCALEDOWN &&
6666
segment.breakpoint < segment.responsiveBreakpoint.breakpoint) {
67-
stringBuffer.write(describeEnum(segment.segmentType) +
68-
' from ' +
69-
segment.responsiveBreakpoint.breakpoint.round().toString());
67+
stringBuffer.write(
68+
'${describeEnum(segment.segmentType)} from ${segment.responsiveBreakpoint.breakpoint.round()}');
7069
} else {
7170
stringBuffer.write(describeEnum(segment.responsiveBreakpoint.behavior));
7271
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ dependencies:
1717
dev_dependencies:
1818
flutter_test:
1919
sdk: flutter
20-
flutter_lints: ^1.0.4
20+
flutter_lints: ^2.0.1
2121

2222
flutter:

0 commit comments

Comments
 (0)