Add spaces after flow control statements (#126320)

This commit is contained in:
Tomasz Gucio 2023-05-15 11:07:30 +02:00 committed by GitHub
parent 231e00d26b
commit 99c7e9f088
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
116 changed files with 264 additions and 174 deletions

View File

@ -68,7 +68,7 @@ class ResampleFlagVariant extends TestVariant<TestScenario> {
late TestScenario currentValue; late TestScenario currentValue;
bool get resample { bool get resample {
switch(currentValue) { switch (currentValue) {
case TestScenario.resampleOn90Hz: case TestScenario.resampleOn90Hz:
case TestScenario.resampleOn59Hz: case TestScenario.resampleOn59Hz:
return true; return true;
@ -78,7 +78,7 @@ class ResampleFlagVariant extends TestVariant<TestScenario> {
} }
} }
double get frequency { double get frequency {
switch(currentValue) { switch (currentValue) {
case TestScenario.resampleOn90Hz: case TestScenario.resampleOn90Hz:
case TestScenario.resampleOff90Hz: case TestScenario.resampleOff90Hz:
return 90.0; return 90.0;
@ -92,7 +92,7 @@ class ResampleFlagVariant extends TestVariant<TestScenario> {
@override @override
String describeValue(TestScenario value) { String describeValue(TestScenario value) {
switch(value) { switch (value) {
case TestScenario.resampleOn90Hz: case TestScenario.resampleOn90Hz:
return 'resample on with 90Hz input'; return 'resample on with 90Hz input';
case TestScenario.resampleOn59Hz: case TestScenario.resampleOn59Hz:

View File

@ -13,7 +13,7 @@ Future<void> main() => driver.integrationDriver(
final Map<String, dynamic> fullyLiveResult = final Map<String, dynamic> fullyLiveResult =
data?['fullyLive'] as Map<String,dynamic>; data?['fullyLive'] as Map<String,dynamic>;
if(benchmarkLiveResult['frame_count'] as int < 10 if (benchmarkLiveResult['frame_count'] as int < 10
|| fullyLiveResult['frame_count'] as int < 10) { || fullyLiveResult['frame_count'] as int < 10) {
print('Failure Details:\nNot Enough frames collected: ' print('Failure Details:\nNot Enough frames collected: '
'benchmarkLive ${benchmarkLiveResult['frameCount']}, ' 'benchmarkLive ${benchmarkLiveResult['frameCount']}, '

View File

@ -112,6 +112,9 @@ Future<void> run(List<String> arguments) async {
printProgress('Trailing spaces...'); printProgress('Trailing spaces...');
await verifyNoTrailingSpaces(flutterRoot); // assumes no unexpected binaries, so should be after verifyNoBinaries await verifyNoTrailingSpaces(flutterRoot); // assumes no unexpected binaries, so should be after verifyNoBinaries
printProgress('Spaces after flow control statements...');
await verifySpacesAfterFlowControlStatements(flutterRoot);
printProgress('Deprecations...'); printProgress('Deprecations...');
await verifyDeprecations(flutterRoot); await verifyDeprecations(flutterRoot);
@ -1040,6 +1043,38 @@ Future<void> verifyNoTrailingSpaces(String workingDirectory, { int minimumMatche
} }
} }
final RegExp _flowControlStatementWithoutSpace = RegExp(r'(^|[ \t])(if|switch|for|do|while|catch)\(', multiLine: true);
Future<void> verifySpacesAfterFlowControlStatements(String workingDirectory, { int minimumMatches = 4000 }) async {
const Set<String> extensions = <String>{
'.dart',
'.java',
'.js',
'.kt',
'.swift',
'.c',
'.cc',
'.cpp',
'.h',
'.m',
};
final List<File> files = await _allFiles(workingDirectory, null, minimumMatches: minimumMatches)
.where((File file) => extensions.contains(path.extension(file.path)))
.toList();
final List<String> problems = <String>[];
for (final File file in files) {
final List<String> lines = file.readAsLinesSync();
for (int index = 0; index < lines.length; index += 1) {
if (lines[index].contains(_flowControlStatementWithoutSpace)) {
problems.add('${file.path}:${index + 1}: no space after flow control statement');
}
}
}
if (problems.isNotEmpty) {
foundError(problems);
}
}
String _bullets(String value) => ' * $value'; String _bullets(String value) => ' * $value';
Future<void> verifyIssueLinks(String workingDirectory) async { Future<void> verifyIssueLinks(String workingDirectory) async {

View File

@ -0,0 +1,37 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// ignore_for_file: type=lint
bool isThereMeaningOfLife = true;
void main() {
if (isThereMeaningOfLife) {}
if(isThereMeaningOfLife) {}
//^
switch (isThereMeaningOfLife) {
case false:
case true:
}
switch(isThereMeaningOfLife) {
// ^
case false:
case true:
}
for (int index = 0; index < 10; index++) {}
for(int index = 0; index < 10; index++) {}
// ^
while (isThereMeaningOfLife) {}
while(isThereMeaningOfLife) {}
// ^
try {
} catch (e) {}
try {
} catch(e) {}
// ^
}

View File

@ -124,6 +124,24 @@ void main() {
); );
}); });
test('analyze.dart - verifySpacesAfterFlowControlStatements', () async {
final String result = await capture(() => verifySpacesAfterFlowControlStatements(testRootPath, minimumMatches: 2), shouldHaveErrors: true);
final String lines = <String>[
'║ test/analyze-test-input/root/packages/foo/spaces_after_flow.dart:11: no space after flow control statement',
'║ test/analyze-test-input/root/packages/foo/spaces_after_flow.dart:18: no space after flow control statement',
'║ test/analyze-test-input/root/packages/foo/spaces_after_flow.dart:25: no space after flow control statement',
'║ test/analyze-test-input/root/packages/foo/spaces_after_flow.dart:29: no space after flow control statement',
'║ test/analyze-test-input/root/packages/foo/spaces_after_flow.dart:35: no space after flow control statement',
]
.map((String line) => line.replaceAll('/', Platform.isWindows ? r'\' : '/'))
.join('\n');
expect(result,
'╔═╡ERROR╞═══════════════════════════════════════════════════════════════════════\n'
'$lines\n'
'╚═══════════════════════════════════════════════════════════════════════════════\n'
);
});
test('analyze.dart - verifyNoBinaries - positive', () async { test('analyze.dart - verifyNoBinaries - positive', () async {
final String result = await capture(() => verifyNoBinaries( final String result = await capture(() => verifyNoBinaries(
testRootPath, testRootPath,

View File

@ -44,7 +44,7 @@ Future<void> main(List<String> rawArgs) async {
test = ABTest.fromJsonMap( test = ABTest.fromJsonMap(
const JsonDecoder().convert(await file.readAsString()) as Map<String, dynamic> const JsonDecoder().convert(await file.readAsString()) as Map<String, dynamic>
); );
} catch(error) { } catch (error) {
_usage('Could not parse json file "$filename"'); _usage('Could not parse json file "$filename"');
return; return;
} }

View File

@ -36,7 +36,7 @@ String getArtifactPath() {
String? _findMatchId(List<String> idList, String idPattern) { String? _findMatchId(List<String> idList, String idPattern) {
String? candidate; String? candidate;
idPattern = idPattern.toLowerCase(); idPattern = idPattern.toLowerCase();
for(final String id in idList) { for (final String id in idList) {
if (id.toLowerCase() == idPattern) { if (id.toLowerCase() == idPattern) {
return id; return id;
} }

View File

@ -252,7 +252,7 @@ public class $pluginClass: NSObject, FlutterPlugin {
// build files. // build files.
await build(buildTarget, validateNativeBuildProject: false); await build(buildTarget, validateNativeBuildProject: false);
switch(buildTarget) { switch (buildTarget) {
case 'apk': case 'apk':
if (await exec( if (await exec(
path.join('.', 'gradlew'), path.join('.', 'gradlew'),

View File

@ -47,7 +47,7 @@ public class MainActivity extends FlutterActivity implements MethodChannel.Metho
@Override @Override
public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) { public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) {
switch(methodCall.method) { switch (methodCall.method) {
case "pipeFlutterViewEvents": case "pipeFlutterViewEvents":
result.success(null); result.success(null);
return; return;

View File

@ -49,7 +49,7 @@ public class SimplePlatformView implements PlatformView, MethodChannel.MethodCal
@Override @Override
public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) { public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) {
switch(methodCall.method) { switch (methodCall.method) {
case "pipeTouchEvents": case "pipeTouchEvents":
touchPipe.enable(); touchPipe.enable();
result.success(null); result.success(null);

View File

@ -31,7 +31,7 @@ class TouchPipe implements View.OnTouchListener {
} }
public void disable() { public void disable() {
if(!mEnabled) if (!mEnabled)
return; return;
mEnabled = false; mEnabled = false;
mView.setOnTouchListener(null); mView.setOnTouchListener(null);

View File

@ -162,7 +162,7 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
diff.write(currentDiff); diff.write(currentDiff);
} }
return diff.toString(); return diff.toString();
} catch(e) { } catch (e) {
return e.toString(); return e.toString();
} }
} }

View File

@ -111,7 +111,7 @@ class WindowManagerBodyState extends State<WindowManagerBody> {
setState(() { setState(() {
_lastTestStatus = _LastTestStatus.success; _lastTestStatus = _LastTestStatus.success;
}); });
} catch(e) { } catch (e) {
setState(() { setState(() {
_lastTestStatus = _LastTestStatus.error; _lastTestStatus = _LastTestStatus.error;
lastError = '$e'; lastError = '$e';
@ -125,7 +125,7 @@ class WindowManagerBodyState extends State<WindowManagerBody> {
setState(() { setState(() {
windowClickCount++; windowClickCount++;
}); });
} catch(e) { } catch (e) {
setState(() { setState(() {
_lastTestStatus = _LastTestStatus.error; _lastTestStatus = _LastTestStatus.error;
lastError = '$e'; lastError = '$e';

View File

@ -224,7 +224,7 @@ class _LeaveBehindListItem extends StatelessWidget {
} }
}, },
confirmDismiss: !confirmDismiss ? null : (DismissDirection dismissDirection) async { confirmDismiss: !confirmDismiss ? null : (DismissDirection dismissDirection) async {
switch(dismissDirection) { switch (dismissDirection) {
case DismissDirection.endToStart: case DismissDirection.endToStart:
return await _showConfirmationDialog(context, 'archive') ?? false; return await _showConfirmationDialog(context, 'archive') ?? false;
case DismissDirection.startToEnd: case DismissDirection.startToEnd:

View File

@ -72,7 +72,7 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
return const UnderlineTabIndicator(); return const UnderlineTabIndicator();
} }
switch(_demoStyle) { switch (_demoStyle) {
case TabsDemoStyle.iconsAndText: case TabsDemoStyle.iconsAndText:
return ShapeDecoration( return ShapeDecoration(
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(

View File

@ -26,7 +26,7 @@ Set<String> _unTestedDemos = Set<String>.from(_allDemos);
class _MessageHandler { class _MessageHandler {
static LiveWidgetController? controller; static LiveWidgetController? controller;
Future<String> call(String message) async { Future<String> call(String message) async {
switch(message) { switch (message) {
case 'demoNames': case 'demoNames':
return const JsonEncoder.withIndent(' ').convert(_allDemos); return const JsonEncoder.withIndent(' ').convert(_allDemos);
case 'profileDemos': case 'profileDemos':

View File

@ -110,7 +110,7 @@ public class MainActivity extends FlutterActivity implements MethodChannel.Metho
@Override @Override
public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) { public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) {
switch(methodCall.method) { switch (methodCall.method) {
case "getStoragePermission": case "getStoragePermission":
if (permissionResult != null) { if (permissionResult != null) {
result.error("error", "already waiting for permissions", null); result.error("error", "already waiting for permissions", null);

View File

@ -50,7 +50,7 @@ public class SimplePlatformView implements PlatformView, MethodChannel.MethodCal
@Override @Override
public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) { public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) {
switch(methodCall.method) { switch (methodCall.method) {
case "pipeTouchEvents": case "pipeTouchEvents":
touchPipe.enable(); touchPipe.enable();
result.success(null); result.success(null);

View File

@ -31,7 +31,7 @@ class TouchPipe implements View.OnTouchListener {
} }
public void disable() { public void disable() {
if(!mEnabled) if (!mEnabled)
return; return;
mEnabled = false; mEnabled = false;
mView.setOnTouchListener(null); mView.setOnTouchListener(null);

View File

@ -144,7 +144,7 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
diff.write(currentDiff); diff.write(currentDiff);
} }
return diff.toString(); return diff.toString();
} catch(e) { } catch (e) {
return e.toString(); return e.toString();
} }
} }

View File

@ -145,7 +145,7 @@ class NestedViewEventBodyState extends State<NestedViewEventBody> {
setState(() { setState(() {
_lastTestStatus = _LastTestStatus.success; _lastTestStatus = _LastTestStatus.success;
}); });
} catch(e) { } catch (e) {
setState(() { setState(() {
_lastTestStatus = _LastTestStatus.error; _lastTestStatus = _LastTestStatus.error;
lastError = '$e'; lastError = '$e';
@ -165,7 +165,7 @@ class NestedViewEventBodyState extends State<NestedViewEventBody> {
setState(() { setState(() {
nestedViewClickCount++; nestedViewClickCount++;
}); });
} catch(e) { } catch (e) {
setState(() { setState(() {
_lastTestStatus = _LastTestStatus.error; _lastTestStatus = _LastTestStatus.error;
lastError = '$e'; lastError = '$e';

View File

@ -91,7 +91,7 @@ class _${blockName}DefaultsM3 extends InputDecorationTheme {
if (states.contains(MaterialState.disabled)) { if (states.contains(MaterialState.disabled)) {
return ${componentColor('md.comp.filled-text-field.disabled.leading-icon')}; return ${componentColor('md.comp.filled-text-field.disabled.leading-icon')};
} }
if(states.contains(MaterialState.error)) { if (states.contains(MaterialState.error)) {
if (states.contains(MaterialState.hovered)) { if (states.contains(MaterialState.hovered)) {
return ${componentColor('md.comp.filled-text-field.error.hover.leading-icon')}; return ${componentColor('md.comp.filled-text-field.error.hover.leading-icon')};
} }
@ -114,7 +114,7 @@ class _${blockName}DefaultsM3 extends InputDecorationTheme {
if (states.contains(MaterialState.disabled)) { if (states.contains(MaterialState.disabled)) {
return ${componentColor('md.comp.filled-text-field.disabled.trailing-icon')}; return ${componentColor('md.comp.filled-text-field.disabled.trailing-icon')};
} }
if(states.contains(MaterialState.error)) {${componentColor('md.comp.filled-text-field.error.trailing-icon') == componentColor('md.comp.filled-text-field.error.focus.trailing-icon') ? '' : ''' if (states.contains(MaterialState.error)) {${componentColor('md.comp.filled-text-field.error.trailing-icon') == componentColor('md.comp.filled-text-field.error.focus.trailing-icon') ? '' : '''
if (states.contains(MaterialState.hovered)) { if (states.contains(MaterialState.hovered)) {
return ${componentColor('md.comp.filled-text-field.error.hover.trailing-icon')}; return ${componentColor('md.comp.filled-text-field.error.hover.trailing-icon')};
} }
@ -138,7 +138,7 @@ class _${blockName}DefaultsM3 extends InputDecorationTheme {
if (states.contains(MaterialState.disabled)) { if (states.contains(MaterialState.disabled)) {
return textStyle.copyWith(color: ${componentColor('md.comp.filled-text-field.disabled.label-text')}); return textStyle.copyWith(color: ${componentColor('md.comp.filled-text-field.disabled.label-text')});
} }
if(states.contains(MaterialState.error)) { if (states.contains(MaterialState.error)) {
if (states.contains(MaterialState.hovered)) { if (states.contains(MaterialState.hovered)) {
return textStyle.copyWith(color: ${componentColor('md.comp.filled-text-field.error.hover.label-text')}); return textStyle.copyWith(color: ${componentColor('md.comp.filled-text-field.error.hover.label-text')});
} }
@ -162,7 +162,7 @@ class _${blockName}DefaultsM3 extends InputDecorationTheme {
if (states.contains(MaterialState.disabled)) { if (states.contains(MaterialState.disabled)) {
return textStyle.copyWith(color: ${componentColor('md.comp.filled-text-field.disabled.label-text')}); return textStyle.copyWith(color: ${componentColor('md.comp.filled-text-field.disabled.label-text')});
} }
if(states.contains(MaterialState.error)) { if (states.contains(MaterialState.error)) {
if (states.contains(MaterialState.hovered)) { if (states.contains(MaterialState.hovered)) {
return textStyle.copyWith(color: ${componentColor('md.comp.filled-text-field.error.hover.label-text')}); return textStyle.copyWith(color: ${componentColor('md.comp.filled-text-field.error.hover.label-text')});
} }

View File

@ -2078,7 +2078,7 @@ class _CupertinoTimerPickerState extends State<CupertinoTimerPicker> {
double maxWidth = double.negativeInfinity; double maxWidth = double.negativeInfinity;
for (int i = 0; i < labels.length; i++) { for (int i = 0; i < labels.length; i++) {
final String? label = labels[i]; final String? label = labels[i];
if(label == null) { if (label == null) {
continue; continue;
} }

View File

@ -236,7 +236,7 @@ class _CupertinoRadioState<T> extends State<CupertinoRadio<T>> with TickerProvid
final bool? accessibilitySelected; final bool? accessibilitySelected;
// Apple devices also use `selected` to annotate radio button's semantics // Apple devices also use `selected` to annotate radio button's semantics
// state. // state.
switch(defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
case TargetPlatform.linux: case TargetPlatform.linux:

View File

@ -212,7 +212,7 @@ class _CupertinoScrollbarState extends RawScrollbarState<CupertinoScrollbar> {
} }
_thicknessAnimationController.reverse(); _thicknessAnimationController.reverse();
super.handleThumbPressEnd(localPosition, velocity); super.handleThumbPressEnd(localPosition, velocity);
switch(direction) { switch (direction) {
case Axis.vertical: case Axis.vertical:
if (velocity.pixelsPerSecond.dy.abs() < 10 && if (velocity.pixelsPerSecond.dy.abs() < 10 &&
(localPosition.dy - _pressStartAxisPosition).abs() > 0) { (localPosition.dy - _pressStartAxisPosition).abs() > 0) {

View File

@ -577,7 +577,7 @@ class _RenderCupertinoSwitch extends RenderConstrainedBox {
bool get isFocused => _isFocused; bool get isFocused => _isFocused;
bool _isFocused; bool _isFocused;
set isFocused(bool value) { set isFocused(bool value) {
if(value == _isFocused) { if (value == _isFocused) {
return; return;
} }
_isFocused = value; _isFocused = value;
@ -637,7 +637,7 @@ class _RenderCupertinoSwitch extends RenderConstrainedBox {
final RRect trackRRect = RRect.fromRectAndRadius(trackRect, const Radius.circular(_kTrackRadius)); final RRect trackRRect = RRect.fromRectAndRadius(trackRect, const Radius.circular(_kTrackRadius));
canvas.drawRRect(trackRRect, paint); canvas.drawRRect(trackRRect, paint);
if(_isFocused) { if (_isFocused) {
// Paints a border around the switch in the focus color. // Paints a border around the switch in the focus color.
final RRect borderTrackRRect = trackRRect.inflate(1.75); final RRect borderTrackRRect = trackRRect.inflate(1.75);

View File

@ -443,7 +443,7 @@ mixin class ChangeNotifier implements Listenable {
if (_listeners[i] == null) { if (_listeners[i] == null) {
// We swap this item with the next not null item. // We swap this item with the next not null item.
int swapIndex = i + 1; int swapIndex = i + 1;
while(_listeners[swapIndex] == null) { while (_listeners[swapIndex] == null) {
swapIndex += 1; swapIndex += 1;
} }
_listeners[i] = _listeners[swapIndex]; _listeners[i] = _listeners[swapIndex];

View File

@ -451,7 +451,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
@override @override
void didStopTrackingLastPointer(int pointer) { void didStopTrackingLastPointer(int pointer) {
assert(_state != _DragState.ready); assert(_state != _DragState.ready);
switch(_state) { switch (_state) {
case _DragState.ready: case _DragState.ready:
break; break;

View File

@ -324,7 +324,7 @@ class _BottomSheetState extends State<BottomSheet> {
void _handleDragHandleHover(bool hovering) { void _handleDragHandleHover(bool hovering) {
if (hovering != dragHandleMaterialState.contains(MaterialState.hovered)) { if (hovering != dragHandleMaterialState.contains(MaterialState.hovered)) {
setState(() { setState(() {
if(hovering){ if (hovering){
dragHandleMaterialState.add(MaterialState.hovered); dragHandleMaterialState.add(MaterialState.hovered);
} }
else{ else{
@ -360,7 +360,7 @@ class _BottomSheetState extends State<BottomSheet> {
// Only add [GestureDetector] to the drag handle when the rest of the // Only add [GestureDetector] to the drag handle when the rest of the
// bottom sheet is not draggable. If the whole bottom sheet is draggable, // bottom sheet is not draggable. If the whole bottom sheet is draggable,
// no need to add it. // no need to add it.
if(!widget.enableDrag) { if (!widget.enableDrag) {
dragHandle = GestureDetector( dragHandle = GestureDetector(
onVerticalDragStart: _handleDragStart, onVerticalDragStart: _handleDragStart,
onVerticalDragUpdate: _handleDragUpdate, onVerticalDragUpdate: _handleDragUpdate,

View File

@ -930,7 +930,7 @@ class _AdaptiveAlertDialog extends AlertDialog {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
switch(theme.platform) { switch (theme.platform) {
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
case TargetPlatform.linux: case TargetPlatform.linux:

View File

@ -502,7 +502,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
_scrimColorTween = _buildScrimColorTween(); _scrimColorTween = _buildScrimColorTween();
} }
if (widget.isDrawerOpen != oldWidget.isDrawerOpen) { if (widget.isDrawerOpen != oldWidget.isDrawerOpen) {
switch(_controller.status) { switch (_controller.status) {
case AnimationStatus.completed: case AnimationStatus.completed:
case AnimationStatus.dismissed: case AnimationStatus.dismissed:
_controller.value = widget.isDrawerOpen ? 1.0 : 0.0; _controller.value = widget.isDrawerOpen ? 1.0 : 0.0;

View File

@ -152,7 +152,7 @@ class _ExpandIconState extends State<ExpandIcon> with SingleTickerProviderStateM
return widget.color!; return widget.color!;
} }
switch(Theme.of(context).brightness) { switch (Theme.of(context).brightness) {
case Brightness.light: case Brightness.light:
return Colors.black54; return Colors.black54;
case Brightness.dark: case Brightness.dark:

View File

@ -556,7 +556,7 @@ class FloatingActionButton extends StatelessWidget {
data: IconThemeData(size: iconSize), data: IconThemeData(size: iconSize),
child: child!, child: child!,
) : child; ) : child;
switch(_floatingActionButtonType) { switch (_floatingActionButtonType) {
case _FloatingActionButtonType.regular: case _FloatingActionButtonType.regular:
sizeConstraints = floatingActionButtonTheme.sizeConstraints ?? defaults.sizeConstraints!; sizeConstraints = floatingActionButtonTheme.sizeConstraints ?? defaults.sizeConstraints!;
case _FloatingActionButtonType.small: case _FloatingActionButtonType.small:

View File

@ -4617,7 +4617,7 @@ class _InputDecoratorDefaultsM3 extends InputDecorationTheme {
if (states.contains(MaterialState.disabled)) { if (states.contains(MaterialState.disabled)) {
return _colors.onSurface.withOpacity(0.38); return _colors.onSurface.withOpacity(0.38);
} }
if(states.contains(MaterialState.error)) { if (states.contains(MaterialState.error)) {
return _colors.error; return _colors.error;
} }
return _colors.onSurfaceVariant; return _colors.onSurfaceVariant;
@ -4629,7 +4629,7 @@ class _InputDecoratorDefaultsM3 extends InputDecorationTheme {
if (states.contains(MaterialState.disabled)) { if (states.contains(MaterialState.disabled)) {
return textStyle.copyWith(color: _colors.onSurface.withOpacity(0.38)); return textStyle.copyWith(color: _colors.onSurface.withOpacity(0.38));
} }
if(states.contains(MaterialState.error)) { if (states.contains(MaterialState.error)) {
if (states.contains(MaterialState.hovered)) { if (states.contains(MaterialState.hovered)) {
return textStyle.copyWith(color: _colors.onErrorContainer); return textStyle.copyWith(color: _colors.onErrorContainer);
} }
@ -4653,7 +4653,7 @@ class _InputDecoratorDefaultsM3 extends InputDecorationTheme {
if (states.contains(MaterialState.disabled)) { if (states.contains(MaterialState.disabled)) {
return textStyle.copyWith(color: _colors.onSurface.withOpacity(0.38)); return textStyle.copyWith(color: _colors.onSurface.withOpacity(0.38));
} }
if(states.contains(MaterialState.error)) { if (states.contains(MaterialState.error)) {
if (states.contains(MaterialState.hovered)) { if (states.contains(MaterialState.hovered)) {
return textStyle.copyWith(color: _colors.onErrorContainer); return textStyle.copyWith(color: _colors.onErrorContainer);
} }

View File

@ -502,7 +502,7 @@ class _RadioState<T> extends State<Radio<T>> with TickerProviderStateMixin, Togg
final bool? accessibilitySelected; final bool? accessibilitySelected;
// Apple devices also use `selected` to annotate radio button's semantics // Apple devices also use `selected` to annotate radio button's semantics
// state. // state.
switch(defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
case TargetPlatform.linux: case TargetPlatform.linux:

View File

@ -596,7 +596,7 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS
color: widget.color, color: widget.color,
); );
switch(widget._indicatorType) { switch (widget._indicatorType) {
case _IndicatorType.material: case _IndicatorType.material:
return materialIndicator; return materialIndicator;

View File

@ -538,7 +538,7 @@ class _SearchPageState<T> extends State<_SearchPage<T>> {
final String searchFieldLabel = widget.delegate.searchFieldLabel final String searchFieldLabel = widget.delegate.searchFieldLabel
?? MaterialLocalizations.of(context).searchFieldLabel; ?? MaterialLocalizations.of(context).searchFieldLabel;
Widget? body; Widget? body;
switch(widget.delegate._currentBody) { switch (widget.delegate._currentBody) {
case _SearchBody.suggestions: case _SearchBody.suggestions:
body = KeyedSubtree( body = KeyedSubtree(
key: const ValueKey<_SearchBody>(_SearchBody.suggestions), key: const ValueKey<_SearchBody>(_SearchBody.suggestions),

View File

@ -1058,7 +1058,7 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
_effectiveFocusNode.canRequestFocus = _canRequestFocus; _effectiveFocusNode.canRequestFocus = _canRequestFocus;
if (_effectiveFocusNode.hasFocus && widget.readOnly != oldWidget.readOnly && _isEnabled) { if (_effectiveFocusNode.hasFocus && widget.readOnly != oldWidget.readOnly && _isEnabled) {
if(_effectiveController.selection.isCollapsed) { if (_effectiveController.selection.isCollapsed) {
_showSelectionHandles = !widget.readOnly; _showSelectionHandles = !widget.readOnly;
} }
} }

View File

@ -2291,7 +2291,7 @@ class _TimePickerDialogState extends State<TimePickerDialog> with RestorationMix
final MaterialLocalizations localizations = MaterialLocalizations.of(context); final MaterialLocalizations localizations = MaterialLocalizations.of(context);
final TimeOfDayFormat timeOfDayFormat = localizations.timeOfDayFormat(alwaysUse24HourFormat: MediaQuery.alwaysUse24HourFormatOf(context)); final TimeOfDayFormat timeOfDayFormat = localizations.timeOfDayFormat(alwaysUse24HourFormat: MediaQuery.alwaysUse24HourFormatOf(context));
final double timePickerWidth; final double timePickerWidth;
switch(timeOfDayFormat) { switch (timeOfDayFormat) {
case TimeOfDayFormat.HH_colon_mm: case TimeOfDayFormat.HH_colon_mm:
case TimeOfDayFormat.HH_dot_mm: case TimeOfDayFormat.HH_dot_mm:
case TimeOfDayFormat.frenchCanadian: case TimeOfDayFormat.frenchCanadian:
@ -2331,7 +2331,7 @@ class _TimePickerDialogState extends State<TimePickerDialog> with RestorationMix
final MaterialLocalizations localizations = MaterialLocalizations.of(context); final MaterialLocalizations localizations = MaterialLocalizations.of(context);
final TimeOfDayFormat timeOfDayFormat = localizations.timeOfDayFormat(alwaysUse24HourFormat: MediaQuery.alwaysUse24HourFormatOf(context)); final TimeOfDayFormat timeOfDayFormat = localizations.timeOfDayFormat(alwaysUse24HourFormat: MediaQuery.alwaysUse24HourFormatOf(context));
final double timePickerWidth; final double timePickerWidth;
switch(timeOfDayFormat) { switch (timeOfDayFormat) {
case TimeOfDayFormat.HH_colon_mm: case TimeOfDayFormat.HH_colon_mm:
case TimeOfDayFormat.HH_dot_mm: case TimeOfDayFormat.HH_dot_mm:
case TimeOfDayFormat.frenchCanadian: case TimeOfDayFormat.frenchCanadian:

View File

@ -254,7 +254,7 @@ abstract class BoxBorder extends ShapeBorder {
required BorderSide bottom, required BorderSide bottom,
}) { }) {
final RRect borderRect; final RRect borderRect;
switch(shape) { switch (shape) {
case BoxShape.rectangle: case BoxShape.rectangle:
borderRect = (borderRadius ?? BorderRadius.zero) borderRect = (borderRadius ?? BorderRadius.zero)
.resolve(textDirection) .resolve(textDirection)
@ -605,7 +605,7 @@ class Border extends BoxBorder {
// Allow painting non-uniform borders if the color and style are uniform. // Allow painting non-uniform borders if the color and style are uniform.
if (_colorIsUniform && _styleIsUniform) { if (_colorIsUniform && _styleIsUniform) {
switch(top.style) { switch (top.style) {
case BorderStyle.none: case BorderStyle.none:
return; return;
case BorderStyle.solid: case BorderStyle.solid:
@ -964,7 +964,7 @@ class BorderDirectional extends BoxBorder {
// Allow painting non-uniform borders if the color and style are uniform. // Allow painting non-uniform borders if the color and style are uniform.
if (_colorIsUniform && _styleIsUniform) { if (_colorIsUniform && _styleIsUniform) {
switch(top.style) { switch (top.style) {
case BorderStyle.none: case BorderStyle.none:
return; return;
case BorderStyle.solid: case BorderStyle.solid:

View File

@ -1199,7 +1199,7 @@ class TextPainter {
// TODO(LongCatIsLooong): make this case impossible; see https://github.com/flutter/flutter/issues/79495 // TODO(LongCatIsLooong): make this case impossible; see https://github.com/flutter/flutter/issues/79495
return null; return null;
} }
return switch(_computeCaretMetrics(position)) { return switch (_computeCaretMetrics(position)) {
_LineCaretMetrics(:final double fullHeight) => fullHeight, _LineCaretMetrics(:final double fullHeight) => fullHeight,
_EmptyLineCaretMetrics() => null, _EmptyLineCaretMetrics() => null,
}; };

View File

@ -1322,7 +1322,7 @@ class ContainerLayer extends Layer {
} }
final List<Layer> children = <Layer>[]; final List<Layer> children = <Layer>[];
Layer? child = firstChild; Layer? child = firstChild;
while(child != null) { while (child != null) {
children.add(child); children.add(child);
if (child is ContainerLayer) { if (child is ContainerLayer) {
children.addAll(child.depthFirstIterateChildren()); children.addAll(child.depthFirstIterateChildren());

View File

@ -1524,7 +1524,7 @@ class _SelectableFragment with Selectable, ChangeNotifier implements TextLayoutM
SelectionResult _handleDirectionallyExtendSelection(double horizontalBaseline, bool isExtent, SelectionExtendDirection movement) { SelectionResult _handleDirectionallyExtendSelection(double horizontalBaseline, bool isExtent, SelectionExtendDirection movement) {
final Matrix4 transform = paragraph.getTransformTo(null); final Matrix4 transform = paragraph.getTransformTo(null);
if (transform.invert() == 0.0) { if (transform.invert() == 0.0) {
switch(movement) { switch (movement) {
case SelectionExtendDirection.previousLine: case SelectionExtendDirection.previousLine:
case SelectionExtendDirection.backward: case SelectionExtendDirection.backward:
return SelectionResult.previous; return SelectionResult.previous;
@ -1537,7 +1537,7 @@ class _SelectableFragment with Selectable, ChangeNotifier implements TextLayoutM
assert(!baselineInParagraphCoordinates.isNaN); assert(!baselineInParagraphCoordinates.isNaN);
final TextPosition newPosition; final TextPosition newPosition;
final SelectionResult result; final SelectionResult result;
switch(movement) { switch (movement) {
case SelectionExtendDirection.previousLine: case SelectionExtendDirection.previousLine:
case SelectionExtendDirection.nextLine: case SelectionExtendDirection.nextLine:
assert(_textSelectionEnd != null && _textSelectionStart != null); assert(_textSelectionEnd != null && _textSelectionStart != null);

View File

@ -153,7 +153,7 @@ abstract class RenderSliverFixedExtentBoxAdaptor extends RenderSliverMultiBoxAda
int _calculateLeadingGarbage(int firstIndex) { int _calculateLeadingGarbage(int firstIndex) {
RenderBox? walker = firstChild; RenderBox? walker = firstChild;
int leadingGarbage = 0; int leadingGarbage = 0;
while(walker != null && indexOf(walker) < firstIndex) { while (walker != null && indexOf(walker) < firstIndex) {
leadingGarbage += 1; leadingGarbage += 1;
walker = childAfter(walker); walker = childAfter(walker);
} }
@ -163,7 +163,7 @@ abstract class RenderSliverFixedExtentBoxAdaptor extends RenderSliverMultiBoxAda
int _calculateTrailingGarbage(int targetLastIndex) { int _calculateTrailingGarbage(int targetLastIndex) {
RenderBox? walker = lastChild; RenderBox? walker = lastChild;
int trailingGarbage = 0; int trailingGarbage = 0;
while(walker != null && indexOf(walker) > targetLastIndex) { while (walker != null && indexOf(walker) > targetLastIndex) {
trailingGarbage += 1; trailingGarbage += 1;
walker = childBefore(walker); walker = childBefore(walker);
} }

View File

@ -151,7 +151,7 @@ class RenderSliverCrossAxisGroup extends RenderSliver with ContainerRenderObject
} }
bool _assertOutOfExtent(double extent) { bool _assertOutOfExtent(double extent) {
if(extent <= 0.0) { if (extent <= 0.0) {
throw FlutterError.fromParts(<DiagnosticsNode>[ throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('SliverCrossAxisGroup ran out of extent before child could be laid out.'), ErrorSummary('SliverCrossAxisGroup ran out of extent before child could be laid out.'),
ErrorDescription( ErrorDescription(

View File

@ -250,7 +250,7 @@ class TableBorder {
} }
} }
} }
if(!isUniform || borderRadius == BorderRadius.zero) { if (!isUniform || borderRadius == BorderRadius.zero) {
paintBorder(canvas, rect, top: top, right: right, bottom: bottom, left: left); paintBorder(canvas, rect, top: top, right: right, bottom: bottom, left: left);
} else { } else {
final RRect outer = borderRadius.toRRect(rect); final RRect outer = borderRadius.toRRect(rect);

View File

@ -72,7 +72,7 @@ class PlatformViewsService {
static final PlatformViewsService _instance = PlatformViewsService._(); static final PlatformViewsService _instance = PlatformViewsService._();
Future<void> _onMethodCall(MethodCall call) { Future<void> _onMethodCall(MethodCall call) {
switch(call.method) { switch (call.method) {
case 'viewFocused': case 'viewFocused':
final int id = call.arguments as int; final int id = call.arguments as int;
if (_focusCallbacks.containsKey(id)) { if (_focusCallbacks.containsKey(id)) {

View File

@ -1137,7 +1137,7 @@ abstract class _SliverAnimatedMultiBoxAdaptorState<T extends _SliverAnimatedMult
/// This method's semantics are the same as Dart's [List.clear] method: it /// This method's semantics are the same as Dart's [List.clear] method: it
/// removes all the items in the list. /// removes all the items in the list.
void removeAllItems(AnimatedRemovedItemBuilder builder, { Duration duration = _kDuration }) { void removeAllItems(AnimatedRemovedItemBuilder builder, { Duration duration = _kDuration }) {
for(int i = _itemsCount - 1 ; i >= 0; i--) { for (int i = _itemsCount - 1 ; i >= 0; i--) {
removeItem(i, builder, duration: duration); removeItem(i, builder, duration: duration);
} }
} }

View File

@ -439,7 +439,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
} }
void _handleDismissUpdateValueChanged() { void _handleDismissUpdateValueChanged() {
if(widget.onUpdate != null) { if (widget.onUpdate != null) {
final bool oldDismissThresholdReached = _dismissThresholdReached; final bool oldDismissThresholdReached = _dismissThresholdReached;
_dismissThresholdReached = _moveController!.value > (widget.dismissThresholds[_dismissDirection] ?? _kDismissThreshold); _dismissThresholdReached = _moveController!.value > (widget.dismissThresholds[_dismissDirection] ?? _kDismissThreshold);
final DismissUpdateDetails details = DismissUpdateDetails( final DismissUpdateDetails details = DismissUpdateDetails(

View File

@ -2896,7 +2896,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
_floatingCursorResetController ??= AnimationController( _floatingCursorResetController ??= AnimationController(
vsync: this, vsync: this,
)..addListener(_onFloatingCursorResetTick); )..addListener(_onFloatingCursorResetTick);
switch(point.state) { switch (point.state) {
case FloatingCursorDragState.Start: case FloatingCursorDragState.Start:
if (_floatingCursorResetController!.isAnimating) { if (_floatingCursorResetController!.isAnimating) {
_floatingCursorResetController!.stop(); _floatingCursorResetController!.stop();

View File

@ -250,7 +250,7 @@ class FormState extends State<Form> {
errorMessage += field.errorText ?? ''; errorMessage += field.errorText ?? '';
} }
if(errorMessage.isNotEmpty) { if (errorMessage.isNotEmpty) {
final TextDirection directionality = Directionality.of(context); final TextDirection directionality = Directionality.of(context);
if (defaultTargetPlatform == TargetPlatform.iOS) { if (defaultTargetPlatform == TargetPlatform.iOS) {
unawaited(Future<void>(() async { unawaited(Future<void>(() async {

View File

@ -1117,7 +1117,7 @@ class _ImageState extends State<Image> with WidgetsBindingObserver {
ImageStreamListener? _imageStreamListener; ImageStreamListener? _imageStreamListener;
ImageStreamListener _getListener({bool recreateListener = false}) { ImageStreamListener _getListener({bool recreateListener = false}) {
if(_imageStreamListener == null || recreateListener) { if (_imageStreamListener == null || recreateListener) {
_lastException = null; _lastException = null;
_lastStack = null; _lastStack = null;
_imageStreamListener = ImageStreamListener( _imageStreamListener = ImageStreamListener(

View File

@ -958,10 +958,10 @@ class _AnimatedAlignState extends AnimatedWidgetBaseState<AnimatedAlign> {
@override @override
void forEachTween(TweenVisitor<dynamic> visitor) { void forEachTween(TweenVisitor<dynamic> visitor) {
_alignment = visitor(_alignment, widget.alignment, (dynamic value) => AlignmentGeometryTween(begin: value as AlignmentGeometry)) as AlignmentGeometryTween?; _alignment = visitor(_alignment, widget.alignment, (dynamic value) => AlignmentGeometryTween(begin: value as AlignmentGeometry)) as AlignmentGeometryTween?;
if(widget.heightFactor != null) { if (widget.heightFactor != null) {
_heightFactorTween = visitor(_heightFactorTween, widget.heightFactor, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?; _heightFactorTween = visitor(_heightFactorTween, widget.heightFactor, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
} }
if(widget.widthFactor != null) { if (widget.widthFactor != null) {
_widthFactorTween = visitor(_widthFactorTween, widget.widthFactor, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?; _widthFactorTween = visitor(_widthFactorTween, widget.widthFactor, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
} }
} }
@ -2171,10 +2171,10 @@ class _AnimatedFractionallySizedBoxState extends AnimatedWidgetBaseState<Animate
@override @override
void forEachTween(TweenVisitor<dynamic> visitor) { void forEachTween(TweenVisitor<dynamic> visitor) {
_alignment = visitor(_alignment, widget.alignment, (dynamic value) => AlignmentGeometryTween(begin: value as AlignmentGeometry)) as AlignmentGeometryTween?; _alignment = visitor(_alignment, widget.alignment, (dynamic value) => AlignmentGeometryTween(begin: value as AlignmentGeometry)) as AlignmentGeometryTween?;
if(widget.heightFactor != null) { if (widget.heightFactor != null) {
_heightFactorTween = visitor(_heightFactorTween, widget.heightFactor, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?; _heightFactorTween = visitor(_heightFactorTween, widget.heightFactor, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
} }
if(widget.widthFactor != null) { if (widget.widthFactor != null) {
_widthFactorTween = visitor(_widthFactorTween, widget.widthFactor, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?; _widthFactorTween = visitor(_widthFactorTween, widget.widthFactor, (dynamic value) => Tween<double>(begin: value as double)) as Tween<double>?;
} }
} }

View File

@ -608,7 +608,7 @@ class _InteractiveViewerState extends State<InteractiveViewer> with TickerProvid
late final Offset alignedTranslation; late final Offset alignedTranslation;
if (_currentAxis != null) { if (_currentAxis != null) {
switch(widget.panAxis){ switch (widget.panAxis){
case PanAxis.horizontal: case PanAxis.horizontal:
alignedTranslation = _alignAxis(translation, Axis.horizontal); alignedTranslation = _alignAxis(translation, Axis.horizontal);
case PanAxis.vertical: case PanAxis.vertical:

View File

@ -70,7 +70,7 @@ class _RenderSemanticsClipper extends RenderProxyBox {
if (_clipDetailsNotifier == newNotifier) { if (_clipDetailsNotifier == newNotifier) {
return; return;
} }
if(attached) { if (attached) {
_clipDetailsNotifier.removeListener(markNeedsSemanticsUpdate); _clipDetailsNotifier.removeListener(markNeedsSemanticsUpdate);
} }
_clipDetailsNotifier = newNotifier; _clipDetailsNotifier = newNotifier;

View File

@ -3722,7 +3722,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
// We found the page for all the consecutive pageless routes below. Attach these // We found the page for all the consecutive pageless routes below. Attach these
// pageless routes to the page. // pageless routes to the page.
if(unattachedPagelessRoutes.isNotEmpty) { if (unattachedPagelessRoutes.isNotEmpty) {
pageRouteToPagelessRoutes.putIfAbsent( pageRouteToPagelessRoutes.putIfAbsent(
oldEntry, oldEntry,
() => List<_RouteEntry>.from(unattachedPagelessRoutes), () => List<_RouteEntry>.from(unattachedPagelessRoutes),
@ -4113,7 +4113,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
} }
int _getIndexBefore(int index, _RouteEntryPredicate predicate) { int _getIndexBefore(int index, _RouteEntryPredicate predicate) {
while(index >= 0 && !predicate(_history[index])) { while (index >= 0 && !predicate(_history[index])) {
index -= 1; index -= 1;
} }
return index; return index;
@ -5013,7 +5013,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
/// {@end-tool} /// {@end-tool}
void popUntil(RoutePredicate predicate) { void popUntil(RoutePredicate predicate) {
_RouteEntry? candidate = _lastRouteEntryWhereOrNull(_RouteEntry.isPresentPredicate); _RouteEntry? candidate = _lastRouteEntryWhereOrNull(_RouteEntry.isPresentPredicate);
while(candidate != null) { while (candidate != null) {
if (predicate(candidate.route)) { if (predicate(candidate.route)) {
return; return;
} }

View File

@ -303,7 +303,7 @@ class _OverlayEntryWidgetState extends State<_OverlayEntryWidget> {
return; return;
} }
_OverlayEntryLocation? candidate = reversed ? children.last : children.first; _OverlayEntryLocation? candidate = reversed ? children.last : children.first;
while(candidate != null) { while (candidate != null) {
final RenderBox? renderBox = candidate._overlayChildRenderBox; final RenderBox? renderBox = candidate._overlayChildRenderBox;
candidate = reversed ? candidate.previous : candidate.next; candidate = reversed ? candidate.previous : candidate.next;
if (renderBox != null) { if (renderBox != null) {
@ -912,7 +912,7 @@ class _RenderTheater extends RenderBox with ContainerRenderObjectMixin<RenderBox
final _TheaterParentData childParentData = child.parentData! as _TheaterParentData; final _TheaterParentData childParentData = child.parentData! as _TheaterParentData;
final Iterator<RenderBox>? iterator = childParentData.paintOrderIterator; final Iterator<RenderBox>? iterator = childParentData.paintOrderIterator;
if (iterator != null) { if (iterator != null) {
while(iterator.moveNext()) { while (iterator.moveNext()) {
iterator.current.attach(owner); iterator.current.attach(owner);
} }
} }

View File

@ -404,7 +404,7 @@ class ScrollDragController implements Drag {
// substantially lower than the carried momentum. // substantially lower than the carried momentum.
final bool isVelocityNotSubstantiallyLessThanCarriedMomentum = final bool isVelocityNotSubstantiallyLessThanCarriedMomentum =
velocity.abs() > carriedVelocity!.abs() * momentumRetainVelocityThresholdFactor; velocity.abs() > carriedVelocity!.abs() * momentumRetainVelocityThresholdFactor;
if(isFlingingInSameDirection && isVelocityNotSubstantiallyLessThanCarriedMomentum) { if (isFlingingInSameDirection && isVelocityNotSubstantiallyLessThanCarriedMomentum) {
velocity += carriedVelocity!; velocity += carriedVelocity!;
} }
} }

View File

@ -261,7 +261,7 @@ class ScrollbarPainter extends ChangeNotifier implements CustomPainter {
OutlinedBorder? _shape; OutlinedBorder? _shape;
set shape(OutlinedBorder? value){ set shape(OutlinedBorder? value){
assert(radius == null || value == null); assert(radius == null || value == null);
if(shape == value) { if (shape == value) {
return; return;
} }
@ -384,7 +384,7 @@ class ScrollbarPainter extends ChangeNotifier implements CustomPainter {
// The track is offset by only padding. // The track is offset by only padding.
double get _totalTrackMainAxisOffsets => _isVertical ? padding.vertical : padding.horizontal; double get _totalTrackMainAxisOffsets => _isVertical ? padding.vertical : padding.horizontal;
double get _leadingTrackMainAxisOffset { double get _leadingTrackMainAxisOffset {
switch(_resolvedOrientation) { switch (_resolvedOrientation) {
case ScrollbarOrientation.left: case ScrollbarOrientation.left:
case ScrollbarOrientation.right: case ScrollbarOrientation.right:
return padding.top; return padding.top;
@ -402,7 +402,7 @@ class ScrollbarPainter extends ChangeNotifier implements CustomPainter {
// Thumb Offsets // Thumb Offsets
// The thumb is offset by padding and margins. // The thumb is offset by padding and margins.
double get _leadingThumbMainAxisOffset { double get _leadingThumbMainAxisOffset {
switch(_resolvedOrientation) { switch (_resolvedOrientation) {
case ScrollbarOrientation.left: case ScrollbarOrientation.left:
case ScrollbarOrientation.right: case ScrollbarOrientation.right:
return padding.top + mainAxisMargin; return padding.top + mainAxisMargin;
@ -558,7 +558,7 @@ class ScrollbarPainter extends ChangeNotifier implements CustomPainter {
final Size thumbSize, trackSize; final Size thumbSize, trackSize;
final Offset trackOffset, borderStart, borderEnd; final Offset trackOffset, borderStart, borderEnd;
_debugAssertIsValidOrientation(_resolvedOrientation); _debugAssertIsValidOrientation(_resolvedOrientation);
switch(_resolvedOrientation) { switch (_resolvedOrientation) {
case ScrollbarOrientation.left: case ScrollbarOrientation.left:
thumbSize = Size(thickness, _thumbExtent); thumbSize = Size(thickness, _thumbExtent);
trackSize = Size(thickness + 2 * crossAxisMargin, _trackExtent); trackSize = Size(thickness + 2 * crossAxisMargin, _trackExtent);
@ -1711,7 +1711,7 @@ class RawScrollbarState<T extends RawScrollbar> extends State<T> with TickerProv
// The physics may allow overscroll when actually *scrolling*, but // The physics may allow overscroll when actually *scrolling*, but
// dragging on the scrollbar does not always allow us to enter overscroll. // dragging on the scrollbar does not always allow us to enter overscroll.
switch(ScrollConfiguration.of(context).getPlatform(context)) { switch (ScrollConfiguration.of(context).getPlatform(context)) {
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
case TargetPlatform.linux: case TargetPlatform.linux:
case TargetPlatform.macOS: case TargetPlatform.macOS:
@ -2133,7 +2133,7 @@ class RawScrollbarState<T extends RawScrollbar> extends State<T> with TickerProv
gestures: _gestures, gestures: _gestures,
child: MouseRegion( child: MouseRegion(
onExit: (PointerExitEvent event) { onExit: (PointerExitEvent event) {
switch(event.kind) { switch (event.kind) {
case PointerDeviceKind.mouse: case PointerDeviceKind.mouse:
case PointerDeviceKind.trackpad: case PointerDeviceKind.trackpad:
if (enableGestures) { if (enableGestures) {
@ -2147,7 +2147,7 @@ class RawScrollbarState<T extends RawScrollbar> extends State<T> with TickerProv
} }
}, },
onHover: (PointerHoverEvent event) { onHover: (PointerHoverEvent event) {
switch(event.kind) { switch (event.kind) {
case PointerDeviceKind.mouse: case PointerDeviceKind.mouse:
case PointerDeviceKind.trackpad: case PointerDeviceKind.trackpad:
if (enableGestures) { if (enableGestures) {

View File

@ -399,7 +399,7 @@ class SelectableRegionState extends State<SelectableRegion> with TextSelectionDe
void _updateSelectionStatus() { void _updateSelectionStatus() {
final TextSelection selection; final TextSelection selection;
final SelectionGeometry geometry = _selectionDelegate.value; final SelectionGeometry geometry = _selectionDelegate.value;
switch(geometry.status) { switch (geometry.status) {
case SelectionStatus.uncollapsed: case SelectionStatus.uncollapsed:
case SelectionStatus.collapsed: case SelectionStatus.collapsed:
selection = const TextSelection(baseOffset: 0, extentOffset: 1); selection = const TextSelection(baseOffset: 0, extentOffset: 1);
@ -1961,7 +1961,7 @@ abstract class MultiSelectableSelectionContainerDelegate extends SelectionContai
SelectionResult handleDirectionallyExtendSelection(DirectionallyExtendSelectionEvent event) { SelectionResult handleDirectionallyExtendSelection(DirectionallyExtendSelectionEvent event) {
assert((currentSelectionStartIndex == -1) == (currentSelectionEndIndex == -1)); assert((currentSelectionStartIndex == -1) == (currentSelectionEndIndex == -1));
if (currentSelectionStartIndex == -1) { if (currentSelectionStartIndex == -1) {
switch(event.direction) { switch (event.direction) {
case SelectionExtendDirection.previousLine: case SelectionExtendDirection.previousLine:
case SelectionExtendDirection.backward: case SelectionExtendDirection.backward:
currentSelectionStartIndex = currentSelectionEndIndex = selectables.length; currentSelectionStartIndex = currentSelectionEndIndex = selectables.length;

View File

@ -1178,7 +1178,7 @@ class SelectionOverlay {
if (!listEquals(_selectionEndpoints, value)) { if (!listEquals(_selectionEndpoints, value)) {
markNeedsBuild(); markNeedsBuild();
if (_isDraggingEndHandle || _isDraggingStartHandle) { if (_isDraggingEndHandle || _isDraggingStartHandle) {
switch(defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.android: case TargetPlatform.android:
HapticFeedback.selectionClick(); HapticFeedback.selectionClick();
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:

View File

@ -193,7 +193,7 @@ class UndoHistoryState<T> extends State<UndoHistory<T>> with UndoManagerClient {
@override @override
void handlePlatformUndo(UndoDirection direction) { void handlePlatformUndo(UndoDirection direction) {
switch(direction) { switch (direction) {
case UndoDirection.undo: case UndoDirection.undo:
undo(); undo();
case UndoDirection.redo: case UndoDirection.redo:

View File

@ -1417,7 +1417,7 @@ mixin WidgetInspectorService {
pubRootDirectories = pubRootDirectories.map<String>((String directory) => Uri.parse(directory).path).toList(); pubRootDirectories = pubRootDirectories.map<String>((String directory) => Uri.parse(directory).path).toList();
final Set<String> directorySet = Set<String>.from(pubRootDirectories); final Set<String> directorySet = Set<String>.from(pubRootDirectories);
if(_pubRootDirectories != null) { if (_pubRootDirectories != null) {
directorySet.addAll(_pubRootDirectories!); directorySet.addAll(_pubRootDirectories!);
} }

View File

@ -445,7 +445,7 @@ void main() {
const ScrollableDetails details = ScrollableDetails(direction: AxisDirection.down); const ScrollableDetails details = ScrollableDetails(direction: AxisDirection.down);
final Widget child = Container(); final Widget child = Container();
switch(defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
case TargetPlatform.iOS: case TargetPlatform.iOS:

View File

@ -80,7 +80,7 @@ class PathBoundsMatcher extends Matcher {
final List<dynamic> values = <dynamic> [bounds, bounds.top, bounds.left, bounds.right, bounds.bottom]; final List<dynamic> values = <dynamic> [bounds, bounds.top, bounds.left, bounds.right, bounds.bottom];
final Map<Matcher, dynamic> failedMatcher = <Matcher, dynamic> {}; final Map<Matcher, dynamic> failedMatcher = <Matcher, dynamic> {};
for(int idx = 0; idx < matchers.length; idx++) { for (int idx = 0; idx < matchers.length; idx++) {
if (!(matchers[idx]?.matches(values[idx], matchState) ?? true)) { if (!(matchers[idx]?.matches(values[idx], matchState) ?? true)) {
failedMatcher[matchers[idx]!] = values[idx]; failedMatcher[matchers[idx]!] = values[idx];
} }

View File

@ -1476,7 +1476,7 @@ void main() {
); );
final Widget child = Container(); final Widget child = Container();
switch(defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
case TargetPlatform.iOS: case TargetPlatform.iOS:
@ -1522,7 +1522,7 @@ void main() {
); );
final Widget child = Container(); final Widget child = Container();
switch(defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
case TargetPlatform.iOS: case TargetPlatform.iOS:

View File

@ -198,7 +198,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
final String? expectedLabel; final String? expectedLabel;
switch(defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.android: case TargetPlatform.android:
expectedLabel = 'Back'; expectedLabel = 'Back';
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
@ -241,7 +241,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
final String? expectedLabel; final String? expectedLabel;
switch(defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.android: case TargetPlatform.android:
expectedLabel = 'Close'; expectedLabel = 'Close';
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:

View File

@ -2206,7 +2206,7 @@ void main() {
return const AlertDialog(title: Text('Title')); return const AlertDialog(title: Text('Title'));
}, },
); );
} catch(exception) { } catch (exception) {
error = exception; error = exception;
} }

View File

@ -157,7 +157,7 @@ TextStyle? getIconStyle(WidgetTester tester, IconData icon) {
} }
void main() { void main() {
for(final bool useMaterial3 in <bool>[true, false]){ for (final bool useMaterial3 in <bool>[true, false]){
testWidgets('InputDecorator input/label text layout', (WidgetTester tester) async { testWidgets('InputDecorator input/label text layout', (WidgetTester tester) async {
// The label appears above the input text // The label appears above the input text
await tester.pumpWidget( await tester.pumpWidget(
@ -380,7 +380,7 @@ void main() {
); );
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(tester.getSize(find.byType(InputDecorator)), const Size(800.0, 56.0)); expect(tester.getSize(find.byType(InputDecorator)), const Size(800.0, 56.0));
if(!useMaterial3) { if (!useMaterial3) {
expect(tester.getTopLeft(find.text('label')).dy, tester.getTopLeft(find.text('hint')).dy); expect(tester.getTopLeft(find.text('label')).dy, tester.getTopLeft(find.text('hint')).dy);
expect(tester.getBottomLeft(find.text('label')).dy, tester.getBottomLeft(find.text('hint')).dy); expect(tester.getBottomLeft(find.text('label')).dy, tester.getBottomLeft(find.text('hint')).dy);
} }
@ -723,7 +723,7 @@ void main() {
); );
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(tester.getSize(find.byType(InputDecorator)), const Size(800.0, 56.0)); expect(tester.getSize(find.byType(InputDecorator)), const Size(800.0, 56.0));
if(!useMaterial3) { if (!useMaterial3) {
expect(tester.getTopLeft(find.byKey(key)).dy, tester.getTopLeft(find.text('hint')).dy); expect(tester.getTopLeft(find.byKey(key)).dy, tester.getTopLeft(find.text('hint')).dy);
expect(tester.getBottomLeft(find.byKey(key)).dy, tester.getBottomLeft(find.text('hint')).dy); expect(tester.getBottomLeft(find.byKey(key)).dy, tester.getBottomLeft(find.text('hint')).dy);
} }

View File

@ -160,7 +160,7 @@ void main() {
scaffoldKey, scaffoldKey,
NavigationDrawer( NavigationDrawer(
children: <Widget>[ children: <Widget>[
for(int i = 0; i < 100; i++) for (int i = 0; i < 100; i++)
NavigationDrawerDestination( NavigationDrawerDestination(
icon: const Icon(Icons.ac_unit), icon: const Icon(Icons.ac_unit),
label: Text('Label$i'), label: Text('Label$i'),
@ -213,7 +213,7 @@ void main() {
key: scaffoldKey, key: scaffoldKey,
drawer: NavigationDrawer( drawer: NavigationDrawer(
children: <Widget>[ children: <Widget>[
for(int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
NavigationDrawerDestination( NavigationDrawerDestination(
icon: const Icon(Icons.ac_unit), icon: const Icon(Icons.ac_unit),
label: Text('Label$i'), label: Text('Label$i'),

View File

@ -2081,7 +2081,7 @@ void main() {
Widget buildApp() { Widget buildApp() {
final PageTransitionsTheme pageTransitionTheme = PageTransitionsTheme( final PageTransitionsTheme pageTransitionTheme = PageTransitionsTheme(
builders: <TargetPlatform, PageTransitionsBuilder>{ builders: <TargetPlatform, PageTransitionsBuilder>{
for(final TargetPlatform platform in TargetPlatform.values) for (final TargetPlatform platform in TargetPlatform.values)
platform: const CupertinoPageTransitionsBuilder(), platform: const CupertinoPageTransitionsBuilder(),
}, },
); );

View File

@ -931,7 +931,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
testWidgets('Vertical and Horizontal Stepper physics test', (WidgetTester tester) async { testWidgets('Vertical and Horizontal Stepper physics test', (WidgetTester tester) async {
const ScrollPhysics physics = NeverScrollableScrollPhysics(); const ScrollPhysics physics = NeverScrollableScrollPhysics();
for(final StepperType type in StepperType.values) { for (final StepperType type in StepperType.values) {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
home: Material( home: Material(

View File

@ -16183,9 +16183,9 @@ void main() {
await click(find.text('Outside')); await click(find.text('Outside'));
switch(pointerDeviceKind) { switch (pointerDeviceKind) {
case PointerDeviceKind.touch: case PointerDeviceKind.touch:
switch(defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:

View File

@ -70,7 +70,7 @@ void main() {
final TestClipPaintingContext context = TestClipPaintingContext(); final TestClipPaintingContext context = TestClipPaintingContext();
final RenderBox child = box200x200; final RenderBox child = box200x200;
final RenderStack stack; final RenderStack stack;
switch(clip){ switch (clip){
case Clip.none: case Clip.none:
case Clip.hardEdge: case Clip.hardEdge:
case Clip.antiAlias: case Clip.antiAlias:

View File

@ -210,7 +210,7 @@ void main() {
for (final Clip? clip in <Clip?>[null, ...Clip.values]) { for (final Clip? clip in <Clip?>[null, ...Clip.values]) {
final RenderWrap wrap; final RenderWrap wrap;
switch(clip){ switch (clip){
case Clip.none: case Clip.none:
case Clip.hardEdge: case Clip.hardEdge:
case Clip.antiAlias: case Clip.antiAlias:

View File

@ -188,7 +188,7 @@ class FakeAndroidPlatformViewsController {
} }
Future<dynamic> _onMethodCall(MethodCall call) { Future<dynamic> _onMethodCall(MethodCall call) {
switch(call.method) { switch (call.method) {
case 'create': case 'create':
return _create(call); return _create(call);
case 'dispose': case 'dispose':
@ -400,7 +400,7 @@ class FakeIosPlatformViewsController {
} }
Future<dynamic> _onMethodCall(MethodCall call) { Future<dynamic> _onMethodCall(MethodCall call) {
switch(call.method) { switch (call.method) {
case 'create': case 'create':
return _create(call); return _create(call);
case 'dispose': case 'dispose':
@ -490,7 +490,7 @@ class FakeHtmlPlatformViewsController {
} }
Future<dynamic> _onMethodCall(MethodCall call) { Future<dynamic> _onMethodCall(MethodCall call) {
switch(call.method) { switch (call.method) {
case 'create': case 'create':
return _create(call); return _create(call);
case 'dispose': case 'dispose':

View File

@ -286,7 +286,7 @@ void main() {
final RenderAnimatedSize renderObject = tester.renderObject(find.byType(AnimatedSize)); final RenderAnimatedSize renderObject = tester.renderObject(find.byType(AnimatedSize));
expect(renderObject.clipBehavior, equals(Clip.hardEdge)); expect(renderObject.clipBehavior, equals(Clip.hardEdge));
for(final Clip clip in Clip.values) { for (final Clip clip in Clip.values) {
await tester.pumpWidget( await tester.pumpWidget(
Center( Center(
child: AnimatedSize( child: AnimatedSize(

View File

@ -607,7 +607,7 @@ void main() {
// Defaults to Clip.none // Defaults to Clip.none
expect(renderObject.clipBehavior, equals(clip ?? Clip.none), reason: 'for clip = $clip'); expect(renderObject.clipBehavior, equals(clip ?? Clip.none), reason: 'for clip = $clip');
switch(clip) { switch (clip) {
case null: case null:
case Clip.none: case Clip.none:
// the UnconstrainedBox overflows. // the UnconstrainedBox overflows.

View File

@ -172,7 +172,7 @@ void main() {
final RenderFlow renderObject = tester.renderObject(find.byType(Flow)); final RenderFlow renderObject = tester.renderObject(find.byType(Flow));
expect(renderObject.clipBehavior, equals(Clip.hardEdge)); expect(renderObject.clipBehavior, equals(Clip.hardEdge));
for(final Clip clip in Clip.values) { for (final Clip clip in Clip.values) {
await tester.pumpWidget( await tester.pumpWidget(
Flow( Flow(
delegate: OpacityFlowDelegate(opacity), delegate: OpacityFlowDelegate(opacity),
@ -201,7 +201,7 @@ void main() {
final RenderFlow renderObject = tester.renderObject(find.byType(Flow)); final RenderFlow renderObject = tester.renderObject(find.byType(Flow));
expect(renderObject.clipBehavior, equals(Clip.hardEdge)); expect(renderObject.clipBehavior, equals(Clip.hardEdge));
for(final Clip clip in Clip.values) { for (final Clip clip in Clip.values) {
await tester.pumpWidget( await tester.pumpWidget(
Flow.unwrapped( Flow.unwrapped(
delegate: OpacityFlowDelegate(opacity), delegate: OpacityFlowDelegate(opacity),

View File

@ -384,7 +384,7 @@ void main() {
Error? error; Error? error;
try { try {
nav.currentState!.pushNamed<Object>('/second'); nav.currentState!.pushNamed<Object>('/second');
} on Error catch(e) { } on Error catch (e) {
error = e; error = e;
} }
expect(error, isNull); expect(error, isNull);

View File

@ -1102,7 +1102,7 @@ void main() {
bool visited = false; bool visited = false;
renderObject.visitChildren((RenderObject child) { renderObject.visitChildren((RenderObject child) {
visited = true; visited = true;
switch(clip) { switch (clip) {
case Clip.none: case Clip.none:
expect(renderObject.describeApproximatePaintClip(child), null); expect(renderObject.describeApproximatePaintClip(child), null);
case Clip.hardEdge: case Clip.hardEdge:

View File

@ -53,7 +53,7 @@ void main() {
const ScrollableDetails details = ScrollableDetails(direction: AxisDirection.down); const ScrollableDetails details = ScrollableDetails(direction: AxisDirection.down);
final Widget child = Container(); final Widget child = Container();
switch(defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
case TargetPlatform.iOS: case TargetPlatform.iOS:

View File

@ -366,7 +366,7 @@ void main() {
await pumpTest(tester, TargetPlatform.fuchsia, controller: controller); await pumpTest(tester, TargetPlatform.fuchsia, controller: controller);
controller.addListener(() { controller.addListener(() {
if(controller.position.userScrollDirection != ScrollDirection.idle) { if (controller.position.userScrollDirection != ScrollDirection.idle) {
lastUserScrollingDirection = controller.position.userScrollDirection; lastUserScrollingDirection = controller.position.userScrollDirection;
} }
}); });

View File

@ -380,7 +380,7 @@ void main() {
await gesture.moveTo(endPos); await gesture.moveTo(endPos);
expect(paragraph.selections[0], const TextSelection(baseOffset: 4, extentOffset: 8)); expect(paragraph.selections[0], const TextSelection(baseOffset: 4, extentOffset: 8));
// Only Android vibrate when dragging the handle. // Only Android vibrate when dragging the handle.
switch(defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.android: case TargetPlatform.android:
expect( expect(
log.last, log.last,
@ -1273,7 +1273,7 @@ void main() {
final bool alt; final bool alt;
final bool control; final bool control;
switch(defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
case TargetPlatform.linux: case TargetPlatform.linux:
@ -1381,7 +1381,7 @@ void main() {
final bool alt; final bool alt;
final bool meta; final bool meta;
switch(defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
case TargetPlatform.linux: case TargetPlatform.linux:
@ -1470,7 +1470,7 @@ void main() {
final bool alt; final bool alt;
final bool meta; final bool meta;
switch(defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
case TargetPlatform.linux: case TargetPlatform.linux:
@ -1759,7 +1759,7 @@ void main() {
final SelectableRegionState regionState = tester.state<SelectableRegionState>(find.byType(SelectableRegion)); final SelectableRegionState regionState = tester.state<SelectableRegionState>(find.byType(SelectableRegion));
// In Android copy should clear the selection. // In Android copy should clear the selection.
switch(defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
expect(regionState.selectionOverlay, isNull); expect(regionState.selectionOverlay, isNull);
@ -1812,7 +1812,7 @@ void main() {
final SelectableRegionState regionState = tester.state<SelectableRegionState>(find.byType(SelectableRegion)); final SelectableRegionState regionState = tester.state<SelectableRegionState>(find.byType(SelectableRegion));
switch(defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:

View File

@ -325,7 +325,7 @@ void main() {
// interpreted as a gesture by the semantics debugger and sent to the widget // interpreted as a gesture by the semantics debugger and sent to the widget
// as a semantic action that always moves by 10% of the complete track. // as a semantic action that always moves by 10% of the complete track.
await tester.fling(find.byType(Slider), const Offset(-100.0, 0.0), 2000.0, warnIfMissed: false); // hitting the debugger await tester.fling(find.byType(Slider), const Offset(-100.0, 0.0), 2000.0, warnIfMissed: false); // hitting the debugger
switch(defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS: case TargetPlatform.macOS:
expect(value, equals(0.65)); expect(value, equals(0.65));

View File

@ -41,7 +41,7 @@ mixin DeserializeCommandFactory {
/// Deserializes the finder from JSON generated by [Command.serialize] or [CommandWithTarget.serialize]. /// Deserializes the finder from JSON generated by [Command.serialize] or [CommandWithTarget.serialize].
Command deserializeCommand(Map<String, String> params, DeserializeFinderFactory finderFactory) { Command deserializeCommand(Map<String, String> params, DeserializeFinderFactory finderFactory) {
final String? kind = params['command']; final String? kind = params['command'];
switch(kind) { switch (kind) {
case 'get_health': return GetHealth.deserialize(params); case 'get_health': return GetHealth.deserialize(params);
case 'get_layer_tree': return GetLayerTree.deserialize(params); case 'get_layer_tree': return GetLayerTree.deserialize(params);
case 'get_render_tree': return GetRenderTree.deserialize(params); case 'get_render_tree': return GetRenderTree.deserialize(params);

View File

@ -155,7 +155,7 @@ mixin CommandHandlerFactory {
/// Deserializes the finder from JSON generated by [Command.serialize] or [CommandWithTarget.serialize]. /// Deserializes the finder from JSON generated by [Command.serialize] or [CommandWithTarget.serialize].
Future<Result> handleCommand(Command command, WidgetController prober, CreateFinderFactory finderFactory) { Future<Result> handleCommand(Command command, WidgetController prober, CreateFinderFactory finderFactory) {
switch(command.kind) { switch (command.kind) {
case 'get_health': return _getHealth(command); case 'get_health': return _getHealth(command);
case 'get_layer_tree': return _getLayerTree(command); case 'get_layer_tree': return _getLayerTree(command);
case 'get_render_tree': return _getRenderTree(command); case 'get_render_tree': return _getRenderTree(command);

View File

@ -448,7 +448,7 @@ class VMServiceFlutterDriver extends FlutterDriver {
Future<bool> _isPrecompiledMode() async { Future<bool> _isPrecompiledMode() async {
final List<Map<String, dynamic>> flags = await getVmFlags(); final List<Map<String, dynamic>> flags = await getVmFlags();
for(final Map<String, dynamic> flag in flags) { for (final Map<String, dynamic> flag in flags) {
if (flag['name'] == 'precompiled_mode') { if (flag['name'] == 'precompiled_mode') {
return flag['valueAsString'] == 'true'; return flag['valueAsString'] == 'true';
} }

View File

@ -136,7 +136,7 @@ class WebFlutterDriver extends FlutterDriver {
} }
_logCommunication('<<< $response'); _logCommunication('<<< $response');
} on DriverError catch(_) { } on DriverError catch (_) {
rethrow; rethrow;
} catch (error, stackTrace) { } catch (error, stackTrace) {
throw DriverError( throw DriverError(

View File

@ -477,7 +477,7 @@ class FlutterLocalFileComparator extends FlutterGoldenFileComparator with LocalC
platform, platform,
); );
if(!baseDirectory.existsSync()) { if (!baseDirectory.existsSync()) {
baseDirectory.createSync(recursive: true); baseDirectory.createSync(recursive: true);
} }

View File

@ -221,7 +221,7 @@ class SkiaGoldClient {
final File resultFile = workDirectory.childFile(fs.path.join( final File resultFile = workDirectory.childFile(fs.path.join(
'result-state.json', 'result-state.json',
)); ));
if(await resultFile.exists()) { if (await resultFile.exists()) {
resultContents = await resultFile.readAsString(); resultContents = await resultFile.readAsString();
} }
@ -344,7 +344,7 @@ class SkiaGoldClient {
final File resultFile = workDirectory.childFile(fs.path.join( final File resultFile = workDirectory.childFile(fs.path.join(
'result-state.json', 'result-state.json',
)); ));
if(await resultFile.exists()) { if (await resultFile.exists()) {
resultContents = await resultFile.readAsString(); resultContents = await resultFile.readAsString();
} }
final StringBuffer buf = StringBuffer() final StringBuffer buf = StringBuffer()
@ -514,7 +514,7 @@ class SkiaGoldClient {
'auth_opt.json', 'auth_opt.json',
))/*!*/; ))/*!*/;
if(await authFile.exists()) { if (await authFile.exists()) {
final String contents = await authFile.readAsString(); final String contents = await authFile.readAsString();
final Map<String, dynamic> decoded = json.decode(contents) as Map<String, dynamic>; final Map<String, dynamic> decoded = json.decode(contents) as Map<String, dynamic>;
return !(decoded['GSUtil'] as bool/*!*/); return !(decoded['GSUtil'] as bool/*!*/);

View File

@ -1091,7 +1091,7 @@ abstract class WidgetController {
), ),
]), ]),
...<PointerEventRecord>[ ...<PointerEventRecord>[
for(int t = 0; t <= intervals; t += 1) for (int t = 0; t <= intervals; t += 1)
PointerEventRecord(timeStamps[t], <PointerEvent>[ PointerEventRecord(timeStamps[t], <PointerEvent>[
PointerMoveEvent( PointerMoveEvent(
timeStamp: timeStamps[t], timeStamp: timeStamps[t],

View File

@ -2445,7 +2445,7 @@ class _MatchesSemanticsData extends Matcher {
final bool actionExpected = actionEntry.value; final bool actionExpected = actionEntry.value;
final bool actionPresent = (action.index & data.actions) == action.index; final bool actionPresent = (action.index & data.actions) == action.index;
if (actionPresent != actionExpected) { if (actionPresent != actionExpected) {
if(actionExpected) { if (actionExpected) {
missingActions.add(action); missingActions.add(action);
} else { } else {
unexpectedActions.add(action); unexpectedActions.add(action);
@ -2490,7 +2490,7 @@ class _MatchesSemanticsData extends Matcher {
final bool flagExpected = flagEntry.value; final bool flagExpected = flagEntry.value;
final bool flagPresent = flag.index & data.flags == flag.index; final bool flagPresent = flag.index & data.flags == flag.index;
if (flagPresent != flagExpected) { if (flagPresent != flagExpected) {
if(flagExpected) { if (flagExpected) {
missingFlags.add(flag); missingFlags.add(flag);
} else { } else {
unexpectedFlags.add(flag); unexpectedFlags.add(flag);

View File

@ -285,7 +285,7 @@ void main() {
await tester.tap(find.text('test'), buttons: kSecondaryMouseButton); await tester.tap(find.text('test'), buttons: kSecondaryMouseButton);
const String b = '$kSecondaryMouseButton'; const String b = '$kSecondaryMouseButton';
for(int i = 0; i < logs.length; i++) { for (int i = 0; i < logs.length; i++) {
if (i == 0) { if (i == 0) {
expect(logs[i], 'down $b'); expect(logs[i], 'down $b');
} else if (i != logs.length - 1) { } else if (i != logs.length - 1) {
@ -342,7 +342,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
const String b = '$kSecondaryMouseButton'; const String b = '$kSecondaryMouseButton';
for(int i = 0; i < logs.length; i++) { for (int i = 0; i < logs.length; i++) {
if (i == 0) { if (i == 0) {
expect(logs[i], 'down $b'); expect(logs[i], 'down $b');
} else if (i != logs.length - 1) { } else if (i != logs.length - 1) {
@ -374,7 +374,7 @@ void main() {
await tester.drag(find.text('test'), const Offset(-150.0, 200.0), buttons: kSecondaryMouseButton); await tester.drag(find.text('test'), const Offset(-150.0, 200.0), buttons: kSecondaryMouseButton);
const String b = '$kSecondaryMouseButton'; const String b = '$kSecondaryMouseButton';
for(int i = 0; i < logs.length; i++) { for (int i = 0; i < logs.length; i++) {
if (i == 0) { if (i == 0) {
expect(logs[i], 'down $b'); expect(logs[i], 'down $b');
} else if (i != logs.length - 1) { } else if (i != logs.length - 1) {
@ -408,7 +408,7 @@ void main() {
await tester.drag(find.text('test'), const Offset(-150.0, 200.0), kind: PointerDeviceKind.trackpad); await tester.drag(find.text('test'), const Offset(-150.0, 200.0), kind: PointerDeviceKind.trackpad);
for(int i = 0; i < logs.length; i++) { for (int i = 0; i < logs.length; i++) {
if (i == 0) { if (i == 0) {
expect(logs[i], 'panZoomStart'); expect(logs[i], 'panZoomStart');
} else if (i != logs.length - 1) { } else if (i != logs.length - 1) {
@ -441,7 +441,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
const String b = '$kSecondaryMouseButton'; const String b = '$kSecondaryMouseButton';
for(int i = 0; i < logs.length; i++) { for (int i = 0; i < logs.length; i++) {
if (i == 0) { if (i == 0) {
expect(logs[i], 'down $b'); expect(logs[i], 'down $b');
} else if (i != logs.length - 1) { } else if (i != logs.length - 1) {
@ -506,7 +506,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
const String b = '$kSecondaryMouseButton'; const String b = '$kSecondaryMouseButton';
for(int i = 0; i < logs.length; i++) { for (int i = 0; i < logs.length; i++) {
if (i == 0) { if (i == 0) {
expect(logs[i], 'down $b'); expect(logs[i], 'down $b');
} else if (i != logs.length - 1) { } else if (i != logs.length - 1) {

View File

@ -159,7 +159,7 @@ final GradleHandledError multidexErrorHandler = GradleHandledError(
prompt: 'Do you want to continue with adding multidex support for Android?', prompt: 'Do you want to continue with adding multidex support for Android?',
defaultChoiceIndex: 0, defaultChoiceIndex: 0,
); );
} on StateError catch(e) { } on StateError catch (e) {
globals.printError( globals.printError(
e.message, e.message,
indent: 0, indent: 0,
@ -273,7 +273,7 @@ final GradleHandledError zipExceptionHandler = GradleHandledError(
defaultChoiceIndex: 0, defaultChoiceIndex: 0,
); );
shouldDeleteUserGradle = selection == 'y'; shouldDeleteUserGradle = selection == 'y';
} on StateError catch(e) { } on StateError catch (e) {
globals.printError( globals.printError(
e.message, e.message,
indent: 0, indent: 0,

View File

@ -340,7 +340,7 @@ class _LinuxUtils extends _PosixUtils {
for (String entry in osReleaseSplit) { for (String entry in osReleaseSplit) {
entry = entry.trim(); entry = entry.trim();
final List<String> entryKeyValuePair = entry.split('='); final List<String> entryKeyValuePair = entry.split('=');
if(entryKeyValuePair[0] == key) { if (entryKeyValuePair[0] == key) {
final String value = entryKeyValuePair[1]; final String value = entryKeyValuePair[1];
// Remove quotes from either end of the value if they exist // Remove quotes from either end of the value if they exist
final String quote = value[0]; final String quote = value[0];

View File

@ -260,7 +260,7 @@ class AssembleCommand extends FlutterCommand {
final Map<String, Object>? defineConfigJsonMap = extractDartDefineConfigJsonMap(); final Map<String, Object>? defineConfigJsonMap = extractDartDefineConfigJsonMap();
final List<String> dartDefines = extractDartDefines(defineConfigJsonMap: defineConfigJsonMap); final List<String> dartDefines = extractDartDefines(defineConfigJsonMap: defineConfigJsonMap);
if(dartDefines.isNotEmpty){ if (dartDefines.isNotEmpty){
results[kDartDefines] = dartDefines.join(','); results[kDartDefines] = dartDefines.join(',');
} }

View File

@ -342,7 +342,7 @@ class DriveCommand extends RunCommandBase {
if (testResult != 0) { if (testResult != 0) {
throwToolExit(null); throwToolExit(null);
} }
} on Exception catch(_) { } on Exception catch (_) {
// On exceptions, including ToolExit, take a screenshot on the device // On exceptions, including ToolExit, take a screenshot on the device
// unless a screenshot was already taken on test failure. // unless a screenshot was already taken on test failure.
if (!screenshotTaken && screenshot != null) { if (!screenshotTaken && screenshot != null) {

View File

@ -316,8 +316,8 @@ class PackagesGetCommand extends FlutterCommand {
name, name,
...subArgs, ...subArgs,
// `dart pub get` and friends defaults to `--no-example`. // `dart pub get` and friends defaults to `--no-example`.
if(!exampleWasParsed && target != null) '--example', if (!exampleWasParsed && target != null) '--example',
if(directoryOption == null && relativeTarget != null) ...<String>['--directory', relativeTarget], if (directoryOption == null && relativeTarget != null) ...<String>['--directory', relativeTarget],
], ],
project: rootProject, project: rootProject,
context: _context, context: _context,

View File

@ -200,7 +200,7 @@ class DwarfSymbolizationService {
.listen((String line) { .listen((String line) {
try { try {
output.writeln(line); output.writeln(line);
} on Exception catch(e, s) { } on Exception catch (e, s) {
subscription?.cancel().whenComplete(() { subscription?.cancel().whenComplete(() {
if (!onDone.isCompleted) { if (!onDone.isCompleted) {
onDone.completeError(e, s); onDone.completeError(e, s);

Some files were not shown because too many files have changed in this diff Show More