some spaces formatting (#29452)

* some space formattings

* always use blocks in if-else if a block is used

* format spaces in for and while

* allow multiline if conditions

* fix missing space
This commit is contained in:
Alexandre Ardhuin 2019-03-20 23:23:31 +01:00 committed by GitHub
parent 4418ec467b
commit a6af422874
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
67 changed files with 243 additions and 248 deletions

View File

@ -440,8 +440,8 @@ class RenderSectorSlice extends RenderSectorWithChildren {
class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChildMixin<RenderSector> {
RenderBoxToRenderSectorAdapter({ double innerRadius = 0.0, RenderSector child }) :
_innerRadius = innerRadius {
RenderBoxToRenderSectorAdapter({ double innerRadius = 0.0, RenderSector child })
: _innerRadius = innerRadius {
this.child = child;
}

View File

@ -514,8 +514,7 @@ class _CupertinoDatePickerDateTimeState extends State<CupertinoDatePicker> {
duration: const Duration(milliseconds: 300),
curve: Curves.easeOut,
);
}
else {
} else {
widget.onDateTimeChanged(_getDateTime());
}
}
@ -608,8 +607,7 @@ class _CupertinoDatePickerDateTimeState extends State<CupertinoDatePicker> {
|| localizations.datePickerDateTimeOrder == DatePickerDateTimeOrder.time_dayPeriod_date) {
pickerBuilders.add(_buildAmPmPicker);
columnWidths.add(_getEstimatedColumnWidth(_PickerColumnType.dayPeriod));
}
else {
} else {
pickerBuilders.insert(0, _buildAmPmPicker);
columnWidths.insert(0, _getEstimatedColumnWidth(_PickerColumnType.dayPeriod));
}
@ -621,8 +619,7 @@ class _CupertinoDatePickerDateTimeState extends State<CupertinoDatePicker> {
|| localizations.datePickerDateTimeOrder == DatePickerDateTimeOrder.dayPeriod_time_date) {
pickerBuilders.add(_buildMediumDatePicker);
columnWidths.add(_getEstimatedColumnWidth(_PickerColumnType.date));
}
else {
} else {
pickerBuilders.insert(0, _buildMediumDatePicker);
columnWidths.insert(0, _getEstimatedColumnWidth(_PickerColumnType.date));
}
@ -1181,8 +1178,7 @@ class _CupertinoTimerPickerState extends State<CupertinoTimerPicker> {
),
),
);
}
else
} else {
return Semantics(
label: semanticsLabel,
excludeSemantics: true,
@ -1199,6 +1195,7 @@ class _CupertinoTimerPickerState extends State<CupertinoTimerPicker> {
),
),
);
}
}),
);
}

View File

@ -2001,8 +2001,7 @@ class _NavigationBarComponentsTransition {
// text.
if (bottomLargeTitle != null &&
topBackLabel != null &&
bottomLargeExpanded
) {
bottomLargeExpanded) {
return PositionedTransition(
rect: animation.drive(slideFromLeadingEdge(
fromKey: bottomComponents.largeTitleKey,

View File

@ -165,9 +165,9 @@ class _CupertinoTabViewState extends State<CupertinoTabView> {
if (name == Navigator.defaultRouteName && widget.builder != null) {
routeBuilder = widget.builder;
title = widget.defaultTitle;
}
else if (widget.routes != null)
} else if (widget.routes != null) {
routeBuilder = widget.routes[name];
}
if (routeBuilder != null) {
return CupertinoPageRoute<dynamic>(
builder: routeBuilder,

View File

@ -760,8 +760,9 @@ class _RenderDecoration extends RenderBox {
// label from changing when text is entered.
final RenderProxyBox typedHint = hint;
visitor(typedHint.child);
} else if (!isFocused && label != null)
} else if (!isFocused && label != null) {
visitor(label);
}
if (input != null)
visitor(input);
if (suffixIcon != null)
@ -1699,9 +1700,8 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
_effectiveDecoration = null;
if (widget._labelShouldWithdraw != old._labelShouldWithdraw && widget.decoration.hasFloatingPlaceholder) {
if (widget._labelShouldWithdraw) {
if (widget._labelShouldWithdraw)
_floatingLabelController.forward();
}
else
_floatingLabelController.reverse();
}

View File

@ -581,8 +581,7 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
// If we start out with a child, have the child appear fully visible instead
// of animating in.
_currentController.value = 1.0;
}
else {
} else {
// If we start without a child we update the geometry object with a
// floating action button scale of 0, as it is not showing on the screen.
_updateGeometryScale(0.0);

View File

@ -260,7 +260,6 @@ class AssetImage extends AssetBundleImageProvider {
static final RegExp _extractRatioRegExp = RegExp(r'/?(\d+(\.\d*)?)x$');
double _parseScale(String key) {
if (key == assetName) {
return _naturalResolution;
}

View File

@ -718,8 +718,7 @@ class RenderEditable extends RenderBox {
assert(!_listenerAttached);
RawKeyboard.instance.addListener(_handleKeyEvent);
_listenerAttached = true;
}
else {
} else {
assert(_listenerAttached);
RawKeyboard.instance.removeListener(_handleKeyEvent);
_listenerAttached = false;
@ -1645,9 +1644,9 @@ class RenderEditable extends RenderBox {
final double adjustedY = math.min(math.max(currentY, topBound), bottomBound);
final Offset adjustedOffset = Offset(adjustedX, adjustedY);
if (currentX < leftBound && deltaPosition.dx < 0) {
if (currentX < leftBound && deltaPosition.dx < 0)
_resetOriginOnLeft = true;
} else if(currentX > rightBound && deltaPosition.dx > 0)
else if (currentX > rightBound && deltaPosition.dx > 0)
_resetOriginOnRight = true;
if (currentY < topBound && deltaPosition.dy < 0)
_resetOriginOnTop = true;

View File

@ -419,7 +419,9 @@ class RenderUiKitView extends RenderBox {
// When the team wins a gesture the recognizer notifies the engine that it should release
// the touch sequence to the embedded UIView.
class _UiKitViewGestureRecognizer extends OneSequenceGestureRecognizer {
_UiKitViewGestureRecognizer(this.controller, this.gestureRecognizerFactories, {
_UiKitViewGestureRecognizer(
this.controller,
this.gestureRecognizerFactories, {
PointerDeviceKind kind,
}) : super(kind: kind) {
team = GestureArenaTeam();
@ -481,7 +483,9 @@ class _UiKitViewGestureRecognizer extends OneSequenceGestureRecognizer {
// When the team wins the recognizer sends all the cached point events to the embedded Android view, and
// sets itself to a "forwarding mode" where it will forward any new pointer event to the Android view.
class _AndroidViewGestureRecognizer extends OneSequenceGestureRecognizer {
_AndroidViewGestureRecognizer(this.dispatcher, this.gestureRecognizerFactories, {
_AndroidViewGestureRecognizer(
this.dispatcher,
this.gestureRecognizerFactories, {
PointerDeviceKind kind,
}) : super(kind: kind) {
team = GestureArenaTeam();

View File

@ -881,11 +881,11 @@ class RenderTable extends RenderBox {
}
assert(tableWidth >= targetWidth);
}
} else // step 2 and 3 are mutually exclusive
} // step 2 and 3 are mutually exclusive
// 3. if there were no flex columns, then grow the table to the
// minWidth.
if (tableWidth < minWidthConstraint) {
else if (tableWidth < minWidthConstraint) {
final double delta = (minWidthConstraint - tableWidth) / columns;
for (int x = 0; x < columns; x += 1)
widths[x] += delta;

View File

@ -733,9 +733,9 @@ class _RenderScrollSemantics extends RenderProxyBox {
final List<SemanticsNode> included = <SemanticsNode>[];
for (SemanticsNode child in children) {
assert(child.isTagged(RenderViewport.useTwoPaneSemantics));
if (child.isTagged(RenderViewport.excludeFromScrolling))
if (child.isTagged(RenderViewport.excludeFromScrolling)) {
excluded.add(child);
else {
} else {
if (!child.hasFlag(SemanticsFlag.isHidden))
firstVisibleIndex ??= child.indexInParent;
included.add(child);

View File

@ -336,8 +336,9 @@ void main() {
TextStyle effectiveStyle = textWidget.style;
effectiveStyle = defaultTextStyle.style.merge(textWidget.style);
expect(effectiveStyle.color, Colors.lightBlue);
} else
} else {
expect(false, true);
}
});
testWidgets('SnackBar button text alignment', (WidgetTester tester) async {

View File

@ -1309,18 +1309,20 @@ class _RendersOnPhysicalModel extends _MatchRenderObject<RenderPhysicalShape, Re
return false;
if (
borderRadius == null
&& shape == BoxShape.rectangle
&& !assertRoundedRectangle(shapeClipper, BorderRadius.zero, matchState)
)
borderRadius == null &&
shape == BoxShape.rectangle &&
!assertRoundedRectangle(shapeClipper, BorderRadius.zero, matchState)
) {
return false;
}
if (
borderRadius == null
&& shape == BoxShape.circle
&& !assertCircle(shapeClipper, matchState)
)
borderRadius == null &&
shape == BoxShape.circle &&
!assertCircle(shapeClipper, matchState)
) {
return false;
}
if (elevation != null && renderObject.elevation != elevation)
return failWithDescription(matchState, 'had elevation: ${renderObject.elevation}');

View File

@ -21,8 +21,7 @@ int reportExpectCall(StackTrace stack, StringBuffer information) {
if (line0.firstMatch(stackLines[0]) != null &&
line1.firstMatch(stackLines[1]) != null &&
line2.firstMatch(stackLines[2]) != null &&
line3.firstMatch(stackLines[3]) != null
) {
line3.firstMatch(stackLines[3]) != null) {
final Match expectMatch = line4.firstMatch(stackLines[4]);
assert(expectMatch != null);
assert(expectMatch.groupCount == 2);

View File

@ -102,10 +102,9 @@ class FlutterManifest {
String get buildName {
if (appVersion != null && appVersion.contains('+'))
return appVersion.split('+')?.elementAt(0);
else {
else
return appVersion;
}
}
/// The build version number from the `pubspec.yaml` file.
/// Can be null if version isn't set or has a wrong format.

View File

@ -187,8 +187,7 @@ Future<String> _chooseSigningIdentity(List<String> validCodeSigningIdentities, b
if (validCodeSigningIdentities.contains(savedCertChoice)) {
printStatus('Found saved certificate choice "$savedCertChoice". To clear, use "flutter config".');
return savedCertChoice;
}
else {
} else {
printError('Saved signing certificate "$savedCertChoice" is not a valid development certificate');
}
}

View File

@ -192,8 +192,7 @@ class CocoaPodsValidator extends DoctorValidator {
status = ValidationType.missing;
messages.add(ValidationMessage.error(
userMessages.cocoaPodsMissing(noCocoaPodsConsequence, cocoaPodsInstallInstructions)));
}
else if (cocoaPodsStatus == CocoaPodsStatus.unknownVersion) {
} else if (cocoaPodsStatus == CocoaPodsStatus.unknownVersion) {
status = ValidationType.partial;
messages.add(ValidationMessage.hint(
userMessages.cocoaPodsUnknownVersion(unknownCocoaPodsConsequence, cocoaPodsUpgradeInstructions)));

View File

@ -599,8 +599,7 @@ Future<void> diagnoseXcodeBuildFailure(XcodeBuildResult result) async {
if (result.xcodeBuildExecution != null &&
result.xcodeBuildExecution.buildForPhysicalDevice &&
!<String>['DEVELOPMENT_TEAM', 'PROVISIONING_PROFILE'].any(
result.xcodeBuildExecution.buildSettings.containsKey)
) {
result.xcodeBuildExecution.buildSettings.containsKey)) {
printError(noDevelopmentTeamInstruction, emphasis: true);
return;
}

View File

@ -54,7 +54,7 @@ void main() {
'success': false,
'details': <String, dynamic>{
'notices': <Map<String, dynamic>>[
<String, dynamic>{ 'message': false, },
<String, dynamic>{'message': false},
],
},
}), false);
@ -63,7 +63,7 @@ void main() {
'success': false,
'details': <String, dynamic>{
'notices': <Map<String, dynamic>>[
<String, dynamic>{ 'message': <String>['error'], },
<String, dynamic>{'message': <String>['error']},
],
},
}), false);
@ -72,8 +72,8 @@ void main() {
'success': false,
'details': <String, dynamic>{
'notices': <Map<String, dynamic>>[
<String, dynamic>{ 'message': 'error', },
<String, dynamic>{ 'message': <String>['error'], },
<String, dynamic>{'message': 'error'},
<String, dynamic>{'message': <String>['error']},
],
},
}), false);
@ -82,7 +82,7 @@ void main() {
'success': false,
'details': <String, dynamic>{
'notices': <Map<String, dynamic>>[
<String, dynamic>{ 'message': 'error', },
<String, dynamic>{'message': 'error'},
],
},
}), false);