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> { class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChildMixin<RenderSector> {
RenderBoxToRenderSectorAdapter({ double innerRadius = 0.0, RenderSector child }) : RenderBoxToRenderSectorAdapter({ double innerRadius = 0.0, RenderSector child })
_innerRadius = innerRadius { : _innerRadius = innerRadius {
this.child = child; this.child = child;
} }

View File

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

View File

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

View File

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

View File

@ -760,8 +760,9 @@ class _RenderDecoration extends RenderBox {
// label from changing when text is entered. // label from changing when text is entered.
final RenderProxyBox typedHint = hint; final RenderProxyBox typedHint = hint;
visitor(typedHint.child); visitor(typedHint.child);
} else if (!isFocused && label != null) } else if (!isFocused && label != null) {
visitor(label); visitor(label);
}
if (input != null) if (input != null)
visitor(input); visitor(input);
if (suffixIcon != null) if (suffixIcon != null)
@ -1699,9 +1700,8 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
_effectiveDecoration = null; _effectiveDecoration = null;
if (widget._labelShouldWithdraw != old._labelShouldWithdraw && widget.decoration.hasFloatingPlaceholder) { if (widget._labelShouldWithdraw != old._labelShouldWithdraw && widget.decoration.hasFloatingPlaceholder) {
if (widget._labelShouldWithdraw) { if (widget._labelShouldWithdraw)
_floatingLabelController.forward(); _floatingLabelController.forward();
}
else else
_floatingLabelController.reverse(); _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 // If we start out with a child, have the child appear fully visible instead
// of animating in. // of animating in.
_currentController.value = 1.0; _currentController.value = 1.0;
} } else {
else {
// If we start without a child we update the geometry object with a // 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. // floating action button scale of 0, as it is not showing on the screen.
_updateGeometryScale(0.0); _updateGeometryScale(0.0);

View File

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

View File

@ -718,8 +718,7 @@ class RenderEditable extends RenderBox {
assert(!_listenerAttached); assert(!_listenerAttached);
RawKeyboard.instance.addListener(_handleKeyEvent); RawKeyboard.instance.addListener(_handleKeyEvent);
_listenerAttached = true; _listenerAttached = true;
} } else {
else {
assert(_listenerAttached); assert(_listenerAttached);
RawKeyboard.instance.removeListener(_handleKeyEvent); RawKeyboard.instance.removeListener(_handleKeyEvent);
_listenerAttached = false; _listenerAttached = false;
@ -1645,9 +1644,9 @@ class RenderEditable extends RenderBox {
final double adjustedY = math.min(math.max(currentY, topBound), bottomBound); final double adjustedY = math.min(math.max(currentY, topBound), bottomBound);
final Offset adjustedOffset = Offset(adjustedX, adjustedY); final Offset adjustedOffset = Offset(adjustedX, adjustedY);
if (currentX < leftBound && deltaPosition.dx < 0) { if (currentX < leftBound && deltaPosition.dx < 0)
_resetOriginOnLeft = true; _resetOriginOnLeft = true;
} else if(currentX > rightBound && deltaPosition.dx > 0) else if (currentX > rightBound && deltaPosition.dx > 0)
_resetOriginOnRight = true; _resetOriginOnRight = true;
if (currentY < topBound && deltaPosition.dy < 0) if (currentY < topBound && deltaPosition.dy < 0)
_resetOriginOnTop = true; _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 // When the team wins a gesture the recognizer notifies the engine that it should release
// the touch sequence to the embedded UIView. // the touch sequence to the embedded UIView.
class _UiKitViewGestureRecognizer extends OneSequenceGestureRecognizer { class _UiKitViewGestureRecognizer extends OneSequenceGestureRecognizer {
_UiKitViewGestureRecognizer(this.controller, this.gestureRecognizerFactories, { _UiKitViewGestureRecognizer(
this.controller,
this.gestureRecognizerFactories, {
PointerDeviceKind kind, PointerDeviceKind kind,
}) : super(kind: kind) { }) : super(kind: kind) {
team = GestureArenaTeam(); 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 // 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. // sets itself to a "forwarding mode" where it will forward any new pointer event to the Android view.
class _AndroidViewGestureRecognizer extends OneSequenceGestureRecognizer { class _AndroidViewGestureRecognizer extends OneSequenceGestureRecognizer {
_AndroidViewGestureRecognizer(this.dispatcher, this.gestureRecognizerFactories, { _AndroidViewGestureRecognizer(
this.dispatcher,
this.gestureRecognizerFactories, {
PointerDeviceKind kind, PointerDeviceKind kind,
}) : super(kind: kind) { }) : super(kind: kind) {
team = GestureArenaTeam(); team = GestureArenaTeam();

View File

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

View File

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

View File

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

View File

@ -1309,18 +1309,20 @@ class _RendersOnPhysicalModel extends _MatchRenderObject<RenderPhysicalShape, Re
return false; return false;
if ( if (
borderRadius == null borderRadius == null &&
&& shape == BoxShape.rectangle shape == BoxShape.rectangle &&
&& !assertRoundedRectangle(shapeClipper, BorderRadius.zero, matchState) !assertRoundedRectangle(shapeClipper, BorderRadius.zero, matchState)
) ) {
return false; return false;
}
if ( if (
borderRadius == null borderRadius == null &&
&& shape == BoxShape.circle shape == BoxShape.circle &&
&& !assertCircle(shapeClipper, matchState) !assertCircle(shapeClipper, matchState)
) ) {
return false; return false;
}
if (elevation != null && renderObject.elevation != elevation) if (elevation != null && renderObject.elevation != elevation)
return failWithDescription(matchState, 'had elevation: ${renderObject.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 && if (line0.firstMatch(stackLines[0]) != null &&
line1.firstMatch(stackLines[1]) != null && line1.firstMatch(stackLines[1]) != null &&
line2.firstMatch(stackLines[2]) != null && line2.firstMatch(stackLines[2]) != null &&
line3.firstMatch(stackLines[3]) != null line3.firstMatch(stackLines[3]) != null) {
) {
final Match expectMatch = line4.firstMatch(stackLines[4]); final Match expectMatch = line4.firstMatch(stackLines[4]);
assert(expectMatch != null); assert(expectMatch != null);
assert(expectMatch.groupCount == 2); assert(expectMatch.groupCount == 2);

View File

@ -102,10 +102,9 @@ class FlutterManifest {
String get buildName { String get buildName {
if (appVersion != null && appVersion.contains('+')) if (appVersion != null && appVersion.contains('+'))
return appVersion.split('+')?.elementAt(0); return appVersion.split('+')?.elementAt(0);
else { else
return appVersion; return appVersion;
} }
}
/// The build version number from the `pubspec.yaml` file. /// The build version number from the `pubspec.yaml` file.
/// Can be null if version isn't set or has a wrong format. /// 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)) { if (validCodeSigningIdentities.contains(savedCertChoice)) {
printStatus('Found saved certificate choice "$savedCertChoice". To clear, use "flutter config".'); printStatus('Found saved certificate choice "$savedCertChoice". To clear, use "flutter config".');
return savedCertChoice; return savedCertChoice;
} } else {
else {
printError('Saved signing certificate "$savedCertChoice" is not a valid development certificate'); printError('Saved signing certificate "$savedCertChoice" is not a valid development certificate');
} }
} }

View File

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

View File

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

View File

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