Skip to content

Commit

Permalink
fix some bad indentations (#41172)
Browse files Browse the repository at this point in the history
  • Loading branch information
a14n committed Sep 24, 2019
1 parent 1ea7600 commit b873162
Show file tree
Hide file tree
Showing 112 changed files with 1,637 additions and 1,422 deletions.
5 changes: 3 additions & 2 deletions packages/flutter/lib/src/cupertino/action_sheet.dart
Expand Up @@ -1063,8 +1063,9 @@ class _RenderCupertinoAlertActions extends RenderBox
..color = pressedColor,
_dividerPaint = Paint()
..color = dividerColor
..style = PaintingStyle.fill
{ addAll(children); }
..style = PaintingStyle.fill {
addAll(children);
}

// The thickness of the divider between buttons.
double get dividerThickness => _dividerThickness;
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/lib/src/cupertino/dialog.dart
Expand Up @@ -1339,7 +1339,7 @@ class _RenderCupertinoDialogActions extends RenderBox
final Paint _pressedButtonBackgroundPaint;
set dialogPressedColor(Color value) {
if (value == _pressedButtonBackgroundPaint.color)
return;
return;

_pressedButtonBackgroundPaint.color = value;
markNeedsPaint();
Expand All @@ -1348,7 +1348,7 @@ class _RenderCupertinoDialogActions extends RenderBox
final Paint _dividerPaint;
set dividerColor(Color value) {
if (value == _dividerPaint.color)
return;
return;

_dividerPaint.color = value;
markNeedsPaint();
Expand Down
6 changes: 3 additions & 3 deletions packages/flutter/lib/src/cupertino/text_selection.dart
Expand Up @@ -225,9 +225,9 @@ class _ToolbarRenderBox extends RenderShiftedBox {
@override
void debugPaintSize(PaintingContext context, Offset offset) {
assert(() {
if (child == null) {
return true;
}
if (child == null) {
return true;
}

_debugPaint ??= Paint()
..shader = ui.Gradient.linear(
Expand Down
10 changes: 8 additions & 2 deletions packages/flutter/lib/src/foundation/binding.dart
Expand Up @@ -98,7 +98,10 @@ abstract class BindingBase {
@mustCallSuper
void initInstances() {
assert(!_debugInitialized);
assert(() { _debugInitialized = true; return true; }());
assert(() {
_debugInitialized = true;
return true;
}());
}

/// Called when the binding is initialized, to register service
Expand Down Expand Up @@ -182,7 +185,10 @@ abstract class BindingBase {
);
return true;
}());
assert(() { _debugServiceExtensionsRegistered = true; return true; }());
assert(() {
_debugServiceExtensionsRegistered = true;
return true;
}());
}

/// Whether [lockEvents] is currently locking events.
Expand Down
5 changes: 4 additions & 1 deletion packages/flutter/lib/src/foundation/debug.dart
Expand Up @@ -52,7 +52,10 @@ bool debugInstrumentationEnabled = false;
/// implicitly add any timeline events.
Future<T> debugInstrumentAction<T>(String description, Future<T> action()) {
bool instrument = false;
assert(() { instrument = debugInstrumentationEnabled; return true; }());
assert(() {
instrument = debugInstrumentationEnabled;
return true;
}());
if (instrument) {
final Stopwatch stopwatch = Stopwatch()..start();
return action().whenComplete(() {
Expand Down
5 changes: 4 additions & 1 deletion packages/flutter/lib/src/gestures/multidrag.dart
Expand Up @@ -163,7 +163,10 @@ abstract class MultiDragPointerState {
void dispose() {
_arenaEntry?.resolve(GestureDisposition.rejected);
_arenaEntry = null;
assert(() { _pendingDelta = null; return true; }());
assert(() {
_pendingDelta = null;
return true;
}());
}
}

Expand Down
Expand Up @@ -49,7 +49,7 @@ class PointerSignalResolver {
}
assert((_currentEvent.original ?? _currentEvent) == event);
try {
_firstRegisteredCallback(_currentEvent);
_firstRegisteredCallback(_currentEvent);
} catch (exception, stack) {
FlutterError.reportError(FlutterErrorDetails(
exception: exception,
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/lib/src/material/app_bar.dart
Expand Up @@ -480,8 +480,8 @@ class _AppBarState extends State<AppBar> {
switch (theme.platform) {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
namesRoute = true;
break;
namesRoute = true;
break;
case TargetPlatform.iOS:
break;
}
Expand Down
3 changes: 1 addition & 2 deletions packages/flutter/lib/src/material/button_theme.dart
Expand Up @@ -620,7 +620,7 @@ class ButtonThemeData extends Diagnosticable {
case ButtonTextTheme.accent:
return colorScheme.secondary;

case ButtonTextTheme.primary: {
case ButtonTextTheme.primary:
final Color fillColor = getFillColor(button);
final bool fillIsDark = fillColor != null
? ThemeData.estimateBrightnessForColor(fillColor) == Brightness.dark
Expand All @@ -630,7 +630,6 @@ class ButtonThemeData extends Diagnosticable {
if (button is FlatButton || button is OutlineButton)
return colorScheme.primary;
return Colors.black;
}
}

assert(false);
Expand Down
33 changes: 16 additions & 17 deletions packages/flutter/lib/src/material/chip.dart
Expand Up @@ -2776,23 +2776,22 @@ class _RenderChip extends RenderBox {

@override
void debugPaint(PaintingContext context, Offset offset) {
assert(!_debugShowTapTargetOutlines ||
() {
// Draws a rect around the tap targets to help with visualizing where
// they really are.
final Paint outlinePaint = Paint()
..color = const Color(0xff800000)
..strokeWidth = 1.0
..style = PaintingStyle.stroke;
if (deleteIconShowing) {
context.canvas.drawRect(deleteButtonRect.shift(offset), outlinePaint);
}
context.canvas.drawRect(
pressRect.shift(offset),
outlinePaint..color = const Color(0xff008000),
);
return true;
}());
assert(!_debugShowTapTargetOutlines || () {
// Draws a rect around the tap targets to help with visualizing where
// they really are.
final Paint outlinePaint = Paint()
..color = const Color(0xff800000)
..strokeWidth = 1.0
..style = PaintingStyle.stroke;
if (deleteIconShowing) {
context.canvas.drawRect(deleteButtonRect.shift(offset), outlinePaint);
}
context.canvas.drawRect(
pressRect.shift(offset),
outlinePaint..color = const Color(0xff008000),
);
return true;
}());
}

@override
Expand Down
22 changes: 10 additions & 12 deletions packages/flutter/lib/src/material/drawer.dart
Expand Up @@ -425,12 +425,12 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
break;
}
switch (Directionality.of(context)) {
case TextDirection.rtl:
_controller.fling(velocity: -visualVelocity);
break;
case TextDirection.ltr:
_controller.fling(velocity: visualVelocity);
break;
case TextDirection.rtl:
_controller.fling(velocity: -visualVelocity);
break;
case TextDirection.ltr:
_controller.fling(velocity: visualVelocity);
break;
}
} else if (_controller.value < 0.5) {
close();
Expand Down Expand Up @@ -492,16 +492,14 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
double dragAreaWidth = widget.edgeDragWidth;
if (widget.edgeDragWidth == null) {
switch (textDirection) {
case TextDirection.ltr: {
case TextDirection.ltr:
dragAreaWidth = _kEdgeDragWidth +
(drawerIsStart ? padding.left : padding.right);
}
break;
case TextDirection.rtl: {
break;
case TextDirection.rtl:
dragAreaWidth = _kEdgeDragWidth +
(drawerIsStart ? padding.right : padding.left);
}
break;
break;
}
}

Expand Down
12 changes: 6 additions & 6 deletions packages/flutter/lib/src/material/dropdown.dart
Expand Up @@ -898,12 +898,12 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
items = widget.selectedItemBuilder == null
? List<Widget>.from(widget.items)
: widget.selectedItemBuilder(context).map((Widget item) {
return Container(
height: _kMenuItemHeight,
alignment: AlignmentDirectional.centerStart,
child: item,
);
}).toList();
return Container(
height: _kMenuItemHeight,
alignment: AlignmentDirectional.centerStart,
child: item,
);
}).toList();
} else {
items = <Widget>[];
}
Expand Down
7 changes: 3 additions & 4 deletions packages/flutter/lib/src/material/input_border.dart
Expand Up @@ -478,16 +478,15 @@ class OutlineInputBorder extends InputBorder {
} else {
final double extent = lerpDouble(0.0, gapExtent + gapPadding * 2.0, gapPercentage);
switch (textDirection) {
case TextDirection.rtl: {
case TextDirection.rtl:
final Path path = _gapBorderPath(canvas, center, math.max(0.0, gapStart + gapPadding - extent), extent);
canvas.drawPath(path, paint);
break;
}
case TextDirection.ltr: {

case TextDirection.ltr:
final Path path = _gapBorderPath(canvas, center, math.max(0.0, gapStart - gapPadding), extent);
canvas.drawPath(path, paint);
break;
}
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion packages/flutter/lib/src/material/material.dart
Expand Up @@ -615,7 +615,10 @@ abstract class InkFeature {
@mustCallSuper
void dispose() {
assert(!_debugDisposed);
assert(() { _debugDisposed = true; return true; }());
assert(() {
_debugDisposed = true;
return true;
}());
_controller._removeFeature(this);
if (onRemoved != null)
onRemoved();
Expand Down
8 changes: 4 additions & 4 deletions packages/flutter/lib/src/material/scaffold.dart
Expand Up @@ -1723,10 +1723,10 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
final LocalHistoryEntry entry = isPersistent
? null
: LocalHistoryEntry(onRemove: () {
if (!removedEntry) {
_removeCurrentBottomSheet();
}
});
if (!removedEntry) {
_removeCurrentBottomSheet();
}
});

bottomSheet = _StandardBottomSheet(
key: bottomSheetKey,
Expand Down
5 changes: 4 additions & 1 deletion packages/flutter/lib/src/material/scrollbar.dart
Expand Up @@ -76,7 +76,10 @@ class _ScrollbarState extends State<Scrollbar> with TickerProviderStateMixin {
@override
void didChangeDependencies() {
super.didChangeDependencies();
assert((() { _useCupertinoScrollbar = null; return true; })());
assert((() {
_useCupertinoScrollbar = null;
return true;
})());
final ThemeData theme = Theme.of(context);
switch (theme.platform) {
case TargetPlatform.iOS:
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/material/selectable_text.dart
Expand Up @@ -440,7 +440,7 @@ class _SelectableTextState extends State<SelectableText> with AutomaticKeepAlive
);
}
if (_effectiveFocusNode.hasFocus && _controller.selection.isCollapsed) {
_showSelectionHandles = false;
_showSelectionHandles = false;
}
}

Expand Down
33 changes: 16 additions & 17 deletions packages/flutter/lib/src/material/slider_theme.dart
Expand Up @@ -2767,23 +2767,22 @@ class _PaddleSliderTrackShapePathPainter {
final double stretch = (neckStretchBaseline * t).clamp(0.0, 10.0 * neckStretchBaseline);
final Offset neckStretch = Offset(0.0, neckStretchBaseline - stretch);

assert(!_debuggingLabelLocation ||
() {
final Offset leftCenter = _topLobeCenter - Offset(leftWidthNeeded, 0.0) + neckStretch;
final Offset rightCenter = _topLobeCenter + Offset(rightWidthNeeded, 0.0) + neckStretch;
final Rect valueRect = Rect.fromLTRB(
leftCenter.dx - _topLobeRadius,
leftCenter.dy - _topLobeRadius,
rightCenter.dx + _topLobeRadius,
rightCenter.dy + _topLobeRadius,
);
final Paint outlinePaint = Paint()
..color = const Color(0xffff0000)
..style = PaintingStyle.stroke
..strokeWidth = 1.0;
canvas.drawRect(valueRect, outlinePaint);
return true;
}());
assert(!_debuggingLabelLocation || () {
final Offset leftCenter = _topLobeCenter - Offset(leftWidthNeeded, 0.0) + neckStretch;
final Offset rightCenter = _topLobeCenter + Offset(rightWidthNeeded, 0.0) + neckStretch;
final Rect valueRect = Rect.fromLTRB(
leftCenter.dx - _topLobeRadius,
leftCenter.dy - _topLobeRadius,
rightCenter.dx + _topLobeRadius,
rightCenter.dy + _topLobeRadius,
);
final Paint outlinePaint = Paint()
..color = const Color(0xffff0000)
..style = PaintingStyle.stroke
..strokeWidth = 1.0;
canvas.drawRect(valueRect, outlinePaint);
return true;
}());

_addArc(
path,
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/material/text_field.dart
Expand Up @@ -122,7 +122,7 @@ class _TextFieldSelectionGestureDetectorBuilder extends TextSelectionGestureDete
break;
case TargetPlatform.android:
case TargetPlatform.fuchsia:
renderEditable.selectWord(cause: SelectionChangedCause.longPress);
renderEditable.selectWord(cause: SelectionChangedCause.longPress);
Feedback.forLongPress(_state.context);
break;
}
Expand Down
Expand Up @@ -125,7 +125,7 @@ class BeveledRectangleBorder extends ShapeBorder {
case BorderStyle.none:
break;
case BorderStyle.solid:
final Path path = getOuterPath(rect, textDirection: textDirection)
final Path path = getOuterPath(rect, textDirection: textDirection)
..addPath(getInnerPath(rect, textDirection: textDirection), Offset.zero);
canvas.drawPath(path, side.toPaint());
break;
Expand Down
Expand Up @@ -138,7 +138,7 @@ class ContinuousRectangleBorder extends ShapeBorder {
return;
switch (side.style) {
case BorderStyle.none:
break;
break;
case BorderStyle.solid:
final Path path = getOuterPath(rect, textDirection: textDirection);
final Paint paint = side.toPaint();
Expand Down
15 changes: 12 additions & 3 deletions packages/flutter/lib/src/rendering/box.dart
Expand Up @@ -275,7 +275,10 @@ class BoxConstraints extends Constraints {
/// separately provided widths and heights.
Size constrain(Size size) {
Size result = Size(constrainWidth(size.width), constrainHeight(size.height));
assert(() { result = _debugPropagateDebugSize(size, result); return true; }());
assert(() {
result = _debugPropagateDebugSize(size, result);
return true;
}());
return result;
}

Expand All @@ -298,7 +301,10 @@ class BoxConstraints extends Constraints {
Size constrainSizeAndAttemptToPreserveAspectRatio(Size size) {
if (isTight) {
Size result = smallest;
assert(() { result = _debugPropagateDebugSize(size, result); return true; }());
assert(() {
result = _debugPropagateDebugSize(size, result);
return true;
}());
return result;
}

Expand Down Expand Up @@ -329,7 +335,10 @@ class BoxConstraints extends Constraints {
}

Size result = Size(constrainWidth(width), constrainHeight(height));
assert(() { result = _debugPropagateDebugSize(size, result); return true; }());
assert(() {
result = _debugPropagateDebugSize(size, result);
return true;
}());
return result;
}

Expand Down

0 comments on commit b873162

Please sign in to comment.