From 323ffe1233d69831cccb32c6ce8b01fef25586e4 Mon Sep 17 00:00:00 2001 From: Alexandre Ardhuin Date: Sat, 12 Jun 2021 09:34:02 +0200 Subject: [PATCH] fix indentation issues (#84374) --- .../flutter/lib/src/animation/curves.dart | 18 +++++----- .../lib/src/foundation/collections.dart | 14 ++++---- .../flutter/lib/src/gestures/binding.dart | 4 +-- .../flutter/lib/src/gestures/resampler.dart | 10 +++--- packages/flutter/lib/src/material/about.dart | 36 +++++++++---------- packages/flutter/lib/src/material/chip.dart | 2 +- .../flutter/lib/src/material/ink_well.dart | 2 +- .../lib/src/material/input_decorator.dart | 2 +- .../lib/src/material/range_slider.dart | 20 +++++------ .../lib/src/material/scrollbar_theme.dart | 2 +- .../lib/src/material/slider_theme.dart | 14 ++++---- .../flutter/lib/src/painting/binding.dart | 3 +- .../flutter/lib/src/painting/image_cache.dart | 2 +- packages/flutter/lib/src/rendering/box.dart | 2 +- packages/flutter/lib/src/rendering/layer.dart | 6 ++-- .../rendering/sliver_persistent_header.dart | 15 ++++---- .../flutter/lib/src/widgets/framework.dart | 2 +- .../flutter/lib/src/widgets/navigator.dart | 32 ++++++++--------- .../widgets/scroll_aware_image_provider.dart | 8 ++--- .../flutter/lib/src/widgets/scrollbar.dart | 8 ++--- .../flutter/lib/src/widgets/shortcuts.dart | 7 ++-- 21 files changed, 106 insertions(+), 103 deletions(-) diff --git a/packages/flutter/lib/src/animation/curves.dart b/packages/flutter/lib/src/animation/curves.dart index dceea757870..13dcfbd04e7 100644 --- a/packages/flutter/lib/src/animation/curves.dart +++ b/packages/flutter/lib/src/animation/curves.dart @@ -745,11 +745,11 @@ class CatmullRomSpline extends Curve2D { static List> _computeSegments( - List controlPoints, - double tension, { - Offset? startHandle, - Offset? endHandle, - }) { + List controlPoints, + double tension, { + Offset? startHandle, + Offset? endHandle, + }) { // If not specified, select the first and last control points (which are // handles: they are not intersected by the resulting curve) so that they // extend the first and last segments, respectively. @@ -989,10 +989,10 @@ class CatmullRomCurve extends Curve { /// In release mode, this function can be used to decide if a proposed /// modification to the curve will result in a valid curve. static bool validateControlPoints( - List? controlPoints, { - double tension = 0.0, - List? reasons, - }) { + List? controlPoints, { + double tension = 0.0, + List? reasons, + }) { assert(tension != null); if (controlPoints == null) { assert(() { diff --git a/packages/flutter/lib/src/foundation/collections.dart b/packages/flutter/lib/src/foundation/collections.dart index d62b1564f8f..44b0680ea86 100644 --- a/packages/flutter/lib/src/foundation/collections.dart +++ b/packages/flutter/lib/src/foundation/collections.dart @@ -269,13 +269,13 @@ void _movingInsertionSort( /// Allows target to be the same list as `list`, as long as it's not overlapping /// the `start..end` range. void _mergeSort( - List list, - int Function(T, T) compare, - int start, - int end, - List target, - int targetOffset, - ) { + List list, + int Function(T, T) compare, + int start, + int end, + List target, + int targetOffset, +) { final int length = end - start; if (length < _kMergeSortLimit) { _movingInsertionSort(list, compare, start, end, target, targetOffset); diff --git a/packages/flutter/lib/src/gestures/binding.dart b/packages/flutter/lib/src/gestures/binding.dart index 1b161740045..3689aef4502 100644 --- a/packages/flutter/lib/src/gestures/binding.dart +++ b/packages/flutter/lib/src/gestures/binding.dart @@ -108,7 +108,7 @@ class _Resampler { // Schedule periodic resampling if `_timer` is not already active. if (_timer?.isActive != true) { - _timer = Timer.periodic(_samplingInterval, (_) => _onSampleTimeChanged()); + _timer = Timer.periodic(_samplingInterval, (_) => _onSampleTimeChanged()); } // Calculate the effective frame time by taking the number @@ -185,7 +185,7 @@ class _Resampler { assert(() { if (debugPrintResamplingMargin) { final Duration resamplingMargin = _lastEventTime - _lastSampleTime; - debugPrint('$resamplingMargin'); + debugPrint('$resamplingMargin'); } return true; }()); diff --git a/packages/flutter/lib/src/gestures/resampler.dart b/packages/flutter/lib/src/gestures/resampler.dart index e637aa1edcf..4020d249df4 100644 --- a/packages/flutter/lib/src/gestures/resampler.dart +++ b/packages/flutter/lib/src/gestures/resampler.dart @@ -169,9 +169,9 @@ class PointerEventResampler { } void _dequeueAndSampleNonHoverOrMovePointerEventsUntil( - Duration sampleTime, - Duration nextSampleTime, - HandleEventCallback callback, + Duration sampleTime, + Duration nextSampleTime, + HandleEventCallback callback, ) { Duration endTime = sampleTime; // Scan queued events to determine end time. @@ -260,8 +260,8 @@ class PointerEventResampler { } void _samplePointerPosition( - Duration sampleTime, - HandleEventCallback callback, + Duration sampleTime, + HandleEventCallback callback, ) { // Position at `sampleTime`. final Offset position = _positionAt(sampleTime); diff --git a/packages/flutter/lib/src/material/about.dart b/packages/flutter/lib/src/material/about.dart index c0bed6b9da3..f8cbcba0c24 100644 --- a/packages/flutter/lib/src/material/about.dart +++ b/packages/flutter/lib/src/material/about.dart @@ -675,23 +675,23 @@ class _PackagesViewState extends State<_PackagesView> { .asMap() .entries .map((MapEntry entry) { - final String packageName = entry.value; - final int index = entry.key; - final List bindings = data.packageLicenseBindings[packageName]!; - return _PackageListTile( - packageName: packageName, - index: index, - isSelected: drawSelection && entry.key == (selectedId ?? 0), - numberLicenses: bindings.length, - onTap: () { - widget.selectedId.value = index; - _MasterDetailFlow.of(context)!.openDetailPage(_DetailArguments( - packageName, - bindings.map((int i) => data.licenses[i]).toList(growable: false), - )); - }, - ); - }), + final String packageName = entry.value; + final int index = entry.key; + final List bindings = data.packageLicenseBindings[packageName]!; + return _PackageListTile( + packageName: packageName, + index: index, + isSelected: drawSelection && entry.key == (selectedId ?? 0), + numberLicenses: bindings.length, + onTap: () { + widget.selectedId.value = index; + _MasterDetailFlow.of(context)!.openDetailPage(_DetailArguments( + packageName, + bindings.map((int i) => data.licenses[i]).toList(growable: false), + )); + }, + ); + }), ], ); } @@ -1419,7 +1419,7 @@ class _MasterPage extends StatelessWidget { @override Widget build(BuildContext context) { - return Scaffold( + return Scaffold( appBar: AppBar( title: title, leading: leading, diff --git a/packages/flutter/lib/src/material/chip.dart b/packages/flutter/lib/src/material/chip.dart index 49e4b9ff02e..14b2092879b 100644 --- a/packages/flutter/lib/src/material/chip.dart +++ b/packages/flutter/lib/src/material/chip.dart @@ -1869,7 +1869,7 @@ class _RawChipState extends State with MaterialStateMixin, TickerProvid ? () { Feedback.forTap(context); widget.onDeleted!(); - } + } : null, child: IconTheme( data: theme.iconTheme.copyWith( diff --git a/packages/flutter/lib/src/material/ink_well.dart b/packages/flutter/lib/src/material/ink_well.dart index 821d28ec13f..b2e9463992f 100644 --- a/packages/flutter/lib/src/material/ink_well.dart +++ b/packages/flutter/lib/src/material/ink_well.dart @@ -107,7 +107,7 @@ abstract class InteractiveInkFeature extends InkFeature { ShapeBorder? customBorder, BorderRadius borderRadius = BorderRadius.zero, RectCallback? clipCallback, - }) { + }) { assert(canvas != null); assert(transform != null); assert(paint != null); diff --git a/packages/flutter/lib/src/material/input_decorator.dart b/packages/flutter/lib/src/material/input_decorator.dart index 6a737b84632..b63140c7860 100644 --- a/packages/flutter/lib/src/material/input_decorator.dart +++ b/packages/flutter/lib/src/material/input_decorator.dart @@ -2036,7 +2036,7 @@ class _InputDecoratorState extends State with TickerProviderStat Color _getDefaultBorderColor(ThemeData themeData) { if (isFocused) { - return themeData.colorScheme.primary; + return themeData.colorScheme.primary; } if (decoration!.filled!) { return themeData.hintColor; diff --git a/packages/flutter/lib/src/material/range_slider.dart b/packages/flutter/lib/src/material/range_slider.dart index 263c54dee51..e2731dafcf4 100644 --- a/packages/flutter/lib/src/material/range_slider.dart +++ b/packages/flutter/lib/src/material/range_slider.dart @@ -1513,12 +1513,12 @@ class _RenderRangeSlider extends RenderBox with RelayoutWhenSystemFontsChangeMix // Create the semantics configuration for a single value. SemanticsConfiguration _createSemanticsConfiguration( - double value, - double increasedValue, - double decreasedValue, - String? label, - VoidCallback increaseAction, - VoidCallback decreaseAction, + double value, + double increasedValue, + double decreasedValue, + String? label, + VoidCallback increaseAction, + VoidCallback decreaseAction, ) { final SemanticsConfiguration config = SemanticsConfiguration(); config.isEnabled = isEnabled; @@ -1544,9 +1544,9 @@ class _RenderRangeSlider extends RenderBox with RelayoutWhenSystemFontsChangeMix @override void assembleSemanticsNode( - SemanticsNode node, - SemanticsConfiguration config, - Iterable children, + SemanticsNode node, + SemanticsConfiguration config, + Iterable children, ) { assert(children.isEmpty); @@ -1609,7 +1609,7 @@ class _RenderRangeSlider extends RenderBox with RelayoutWhenSystemFontsChangeMix void _increaseStartAction() { if (isEnabled) { - onChanged!(RangeValues(_increasedStartValue, values.end)); + onChanged!(RangeValues(_increasedStartValue, values.end)); } } diff --git a/packages/flutter/lib/src/material/scrollbar_theme.dart b/packages/flutter/lib/src/material/scrollbar_theme.dart index faff7eaa6ad..02c9414d37a 100644 --- a/packages/flutter/lib/src/material/scrollbar_theme.dart +++ b/packages/flutter/lib/src/material/scrollbar_theme.dart @@ -228,7 +228,7 @@ class ScrollbarThemeData with Diagnosticable { MaterialStateProperty? b, double t, T Function(T?, T?, double) lerpFunction, - ) { + ) { // Avoid creating a _LerpProperties object for a common case. if (a == null && b == null) return null; diff --git a/packages/flutter/lib/src/material/slider_theme.dart b/packages/flutter/lib/src/material/slider_theme.dart index 2e5da686e8f..396cc8e7f3e 100644 --- a/packages/flutter/lib/src/material/slider_theme.dart +++ b/packages/flutter/lib/src/material/slider_theme.dart @@ -2549,14 +2549,14 @@ class RectangularSliderValueIndicatorShape extends SliderComponentShape { @override Size getPreferredSize( - bool isEnabled, - bool isDiscrete, { - TextPainter? labelPainter, - double? textScaleFactor, + bool isEnabled, + bool isDiscrete, { + TextPainter? labelPainter, + double? textScaleFactor, }) { - assert(labelPainter != null); - assert(textScaleFactor != null && textScaleFactor >= 0); - return _pathPainter.getPreferredSize(labelPainter!, textScaleFactor!); + assert(labelPainter != null); + assert(textScaleFactor != null && textScaleFactor >= 0); + return _pathPainter.getPreferredSize(labelPainter!, textScaleFactor!); } @override diff --git a/packages/flutter/lib/src/painting/binding.dart b/packages/flutter/lib/src/painting/binding.dart index 4d8f2daaf87..905dbc902be 100644 --- a/packages/flutter/lib/src/painting/binding.dart +++ b/packages/flutter/lib/src/painting/binding.dart @@ -94,7 +94,8 @@ mixin PaintingBinding on BindingBase, ServicesBinding { /// unnecessary memory usage for images. Callers that wish to display an image /// above its native resolution should prefer scaling the canvas the image is /// drawn into. - Future instantiateImageCodec(Uint8List bytes, { + Future instantiateImageCodec( + Uint8List bytes, { int? cacheWidth, int? cacheHeight, bool allowUpscaling = false, diff --git a/packages/flutter/lib/src/painting/image_cache.dart b/packages/flutter/lib/src/painting/image_cache.dart index be397b546c9..7ef7637ce9b 100644 --- a/packages/flutter/lib/src/painting/image_cache.dart +++ b/packages/flutter/lib/src/painting/image_cache.dart @@ -106,7 +106,7 @@ class ImageCache { return; TimelineTask? timelineTask; if (!kReleaseMode) { - timelineTask = TimelineTask()..start( + timelineTask = TimelineTask()..start( 'ImageCache.setMaximumSize', arguments: {'value': value}, ); diff --git a/packages/flutter/lib/src/rendering/box.dart b/packages/flutter/lib/src/rendering/box.dart index c1b224b58e6..bcb28aa15a7 100644 --- a/packages/flutter/lib/src/rendering/box.dart +++ b/packages/flutter/lib/src/rendering/box.dart @@ -2208,7 +2208,7 @@ abstract class RenderBox extends RenderObject { DiagnosticsProperty('The exact size it was given was', _size, style: DiagnosticsTreeStyle.errorProperty), ErrorHint('See https://flutter.dev/docs/development/ui/layout/box-constraints for more information.'), ]); - } + } // verify that the size is within the constraints if (!constraints.isSatisfiedBy(_size!)) { throw FlutterError.fromParts([ diff --git a/packages/flutter/lib/src/rendering/layer.dart b/packages/flutter/lib/src/rendering/layer.dart index 64b2eab0e4a..40a6a8e6343 100644 --- a/packages/flutter/lib/src/rendering/layer.dart +++ b/packages/flutter/lib/src/rendering/layer.dart @@ -2282,8 +2282,10 @@ class FollowerLayer extends ContainerLayer { /// Returns null if [a] [b] do not share a common ancestor, in which case the /// results in [ancestorsA] and [ancestorsB] are undefined. static Layer? _pathsToCommonAncestor( - Layer? a, Layer? b, - List ancestorsA, List ancestorsB, + Layer? a, + Layer? b, + List ancestorsA, + List ancestorsB, ) { // No common ancestor found. if (a == null || b == null) diff --git a/packages/flutter/lib/src/rendering/sliver_persistent_header.dart b/packages/flutter/lib/src/rendering/sliver_persistent_header.dart index 3fdac1f6d20..99406794a68 100644 --- a/packages/flutter/lib/src/rendering/sliver_persistent_header.dart +++ b/packages/flutter/lib/src/rendering/sliver_persistent_header.dart @@ -18,7 +18,8 @@ import 'viewport_offset.dart'; // Trims the specified edges of the given `Rect` [original], so that they do not // exceed the given values. -Rect? _trim(Rect? original, { +Rect? _trim( + Rect? original, { double top = -double.infinity, double right = double.infinity, double bottom = double.infinity, @@ -636,12 +637,12 @@ abstract class RenderSliverFloatingPersistentHeader extends RenderSliverPersiste final AnimationController effectiveController = _controller ??= AnimationController(vsync: vsync!, duration: duration) - ..addListener(() { - if (_effectiveScrollOffset == _animation.value) - return; - _effectiveScrollOffset = _animation.value; - markNeedsLayout(); - }); + ..addListener(() { + if (_effectiveScrollOffset == _animation.value) + return; + _effectiveScrollOffset = _animation.value; + markNeedsLayout(); + }); _animation = effectiveController.drive( Tween( diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index bf0029c8050..9512101101f 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -376,7 +376,7 @@ abstract class Widget extends DiagnosticableTree { return widget is StatefulWidget ? 1 : widget is StatelessWidget ? 2 : 0; - } + } } /// A widget that does not require mutable state. diff --git a/packages/flutter/lib/src/widgets/navigator.dart b/packages/flutter/lib/src/widgets/navigator.dart index f5eb39b5d38..78fc907b6f4 100644 --- a/packages/flutter/lib/src/widgets/navigator.dart +++ b/packages/flutter/lib/src/widgets/navigator.dart @@ -1738,7 +1738,7 @@ class Navigator extends StatefulWidget { BuildContext context, String routeName, { Object? arguments, - }) { + }) { return Navigator.of(context).pushNamed(routeName, arguments: arguments); } @@ -1950,7 +1950,7 @@ class Navigator extends StatefulWidget { String routeName, { TO? result, Object? arguments, - }) { + }) { return Navigator.of(context).popAndPushNamed(routeName, arguments: arguments, result: result); } @@ -1981,11 +1981,11 @@ class Navigator extends StatefulWidget { /// {@end-tool} @optionalTypeArgs static String restorablePopAndPushNamed( - BuildContext context, - String routeName, { - TO? result, - Object? arguments, - }) { + BuildContext context, + String routeName, { + TO? result, + Object? arguments, + }) { return Navigator.of(context).restorablePopAndPushNamed(routeName, arguments: arguments, result: result); } @@ -2086,11 +2086,11 @@ class Navigator extends StatefulWidget { /// {@end-tool} @optionalTypeArgs static String restorablePushNamedAndRemoveUntil( - BuildContext context, - String newRouteName, - RoutePredicate predicate, { - Object? arguments, - }) { + BuildContext context, + String newRouteName, + RoutePredicate predicate, { + Object? arguments, + }) { return Navigator.of(context).restorablePushNamedAndRemoveUntil(newRouteName, predicate, arguments: arguments); } @@ -2728,7 +2728,7 @@ class Navigator extends StatefulWidget { // Handles the case where the input context is a navigator element. NavigatorState? navigator; if (context is StatefulElement && context.state is NavigatorState) { - navigator = context.state as NavigatorState; + navigator = context.state as NavigatorState; } if (rootNavigator) { navigator = context.findRootAncestorStateOfType() ?? navigator; @@ -2772,9 +2772,9 @@ class Navigator extends StatefulWidget { /// /// This method can be expensive (it walks the element tree). static NavigatorState? maybeOf( - BuildContext context, { - bool rootNavigator = false, - }) { + BuildContext context, { + bool rootNavigator = false, + }) { // Handles the case where the input context is a navigator element. NavigatorState? navigator; if (context is StatefulElement && context.state is NavigatorState) { diff --git a/packages/flutter/lib/src/widgets/scroll_aware_image_provider.dart b/packages/flutter/lib/src/widgets/scroll_aware_image_provider.dart index 0c000916f29..27f784a7353 100644 --- a/packages/flutter/lib/src/widgets/scroll_aware_image_provider.dart +++ b/packages/flutter/lib/src/widgets/scroll_aware_image_provider.dart @@ -96,10 +96,10 @@ class ScrollAwareImageProvider extends ImageProvider { // Try to get to end of the frame callbacks of the next frame, and then // check again. if (Scrollable.recommendDeferredLoadingForContext(context.context!)) { - SchedulerBinding.instance!.scheduleFrameCallback((_) { - scheduleMicrotask(() => resolveStreamForKey(configuration, stream, key, handleError)); - }); - return; + SchedulerBinding.instance!.scheduleFrameCallback((_) { + scheduleMicrotask(() => resolveStreamForKey(configuration, stream, key, handleError)); + }); + return; } // We are in the tree, we're not scrolling too fast, the cache doesn't // have our image, and no one has otherwise completed the stream. Go. diff --git a/packages/flutter/lib/src/widgets/scrollbar.dart b/packages/flutter/lib/src/widgets/scrollbar.dart index 00a3a8cca18..eb5d2f3af81 100644 --- a/packages/flutter/lib/src/widgets/scrollbar.dart +++ b/packages/flutter/lib/src/widgets/scrollbar.dart @@ -1345,12 +1345,12 @@ class RawScrollbarState extends State with TickerProv gestures[_ThumbPressGestureRecognizer] = GestureRecognizerFactoryWithHandlers<_ThumbPressGestureRecognizer>( - () => _ThumbPressGestureRecognizer( + () => _ThumbPressGestureRecognizer( debugOwner: this, customPaintKey: _scrollbarPainterKey, pressDuration: widget.pressDuration, ), - (_ThumbPressGestureRecognizer instance) { + (_ThumbPressGestureRecognizer instance) { instance.onLongPress = handleThumbPress; instance.onLongPressStart = (LongPressStartDetails details) => handleThumbPressStart(details.localPosition); instance.onLongPressMoveUpdate = (LongPressMoveUpdateDetails details) => handleThumbPressUpdate(details.localPosition); @@ -1360,11 +1360,11 @@ class RawScrollbarState extends State with TickerProv gestures[_TrackTapGestureRecognizer] = GestureRecognizerFactoryWithHandlers<_TrackTapGestureRecognizer>( - () => _TrackTapGestureRecognizer( + () => _TrackTapGestureRecognizer( debugOwner: this, customPaintKey: _scrollbarPainterKey, ), - (_TrackTapGestureRecognizer instance) { + (_TrackTapGestureRecognizer instance) { instance.onTapDown = _handleTrackTapDown; }, ); diff --git a/packages/flutter/lib/src/widgets/shortcuts.dart b/packages/flutter/lib/src/widgets/shortcuts.dart index 60f11add3b6..1c7e0122197 100644 --- a/packages/flutter/lib/src/widgets/shortcuts.dart +++ b/packages/flutter/lib/src/widgets/shortcuts.dart @@ -336,8 +336,8 @@ class LogicalKeySet extends KeySet with Diagnosticable @override String debugDescribeKeys() { - final List sortedKeys = keys.toList()..sort( - (LogicalKeyboardKey a, LogicalKeyboardKey b) { + final List sortedKeys = keys.toList() + ..sort((LogicalKeyboardKey a, LogicalKeyboardKey b) { // Put the modifiers first. If it has a synonym, then it's something // like shiftLeft, altRight, etc. final bool aIsModifier = a.synonyms.isNotEmpty || _modifiers.contains(a); @@ -348,8 +348,7 @@ class LogicalKeySet extends KeySet with Diagnosticable return 1; } return a.debugName!.compareTo(b.debugName!); - }, - ); + }); return sortedKeys.map((LogicalKeyboardKey key) => key.debugName.toString()).join(' + '); }