fix indentation issues (#84374)

This commit is contained in:
Alexandre Ardhuin 2021-06-12 09:34:02 +02:00 committed by GitHub
parent 62633210db
commit 323ffe1233
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 106 additions and 103 deletions

View file

@ -745,11 +745,11 @@ class CatmullRomSpline extends Curve2D {
static List<List<Offset>> _computeSegments(
List<Offset> controlPoints,
double tension, {
Offset? startHandle,
Offset? endHandle,
}) {
List<Offset> 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<Offset>? controlPoints, {
double tension = 0.0,
List<String>? reasons,
}) {
List<Offset>? controlPoints, {
double tension = 0.0,
List<String>? reasons,
}) {
assert(tension != null);
if (controlPoints == null) {
assert(() {

View file

@ -269,13 +269,13 @@ void _movingInsertionSort<T>(
/// Allows target to be the same list as `list`, as long as it's not overlapping
/// the `start..end` range.
void _mergeSort<T>(
List<T> list,
int Function(T, T) compare,
int start,
int end,
List<T> target,
int targetOffset,
) {
List<T> list,
int Function(T, T) compare,
int start,
int end,
List<T> target,
int targetOffset,
) {
final int length = end - start;
if (length < _kMergeSortLimit) {
_movingInsertionSort<T>(list, compare, start, end, target, targetOffset);

View file

@ -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;
}());

View file

@ -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);

View file

@ -675,23 +675,23 @@ class _PackagesViewState extends State<_PackagesView> {
.asMap()
.entries
.map<Widget>((MapEntry<int, String> entry) {
final String packageName = entry.value;
final int index = entry.key;
final List<int> 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<int> 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,

View file

@ -1869,7 +1869,7 @@ class _RawChipState extends State<RawChip> with MaterialStateMixin, TickerProvid
? () {
Feedback.forTap(context);
widget.onDeleted!();
}
}
: null,
child: IconTheme(
data: theme.iconTheme.copyWith(

View file

@ -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);

View file

@ -2036,7 +2036,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
Color _getDefaultBorderColor(ThemeData themeData) {
if (isFocused) {
return themeData.colorScheme.primary;
return themeData.colorScheme.primary;
}
if (decoration!.filled!) {
return themeData.hintColor;

View file

@ -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<SemanticsNode> children,
SemanticsNode node,
SemanticsConfiguration config,
Iterable<SemanticsNode> 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));
}
}

View file

@ -228,7 +228,7 @@ class ScrollbarThemeData with Diagnosticable {
MaterialStateProperty<T>? 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;

View file

@ -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

View file

@ -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<ui.Codec> instantiateImageCodec(Uint8List bytes, {
Future<ui.Codec> instantiateImageCodec(
Uint8List bytes, {
int? cacheWidth,
int? cacheHeight,
bool allowUpscaling = false,

View file

@ -106,7 +106,7 @@ class ImageCache {
return;
TimelineTask? timelineTask;
if (!kReleaseMode) {
timelineTask = TimelineTask()..start(
timelineTask = TimelineTask()..start(
'ImageCache.setMaximumSize',
arguments: <String, dynamic>{'value': value},
);

View file

@ -2208,7 +2208,7 @@ abstract class RenderBox extends RenderObject {
DiagnosticsProperty<Size>('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(<DiagnosticsNode>[

View file

@ -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<ContainerLayer?> ancestorsA, List<ContainerLayer?> ancestorsB,
Layer? a,
Layer? b,
List<ContainerLayer?> ancestorsA,
List<ContainerLayer?> ancestorsB,
) {
// No common ancestor found.
if (a == null || b == null)

View file

@ -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<double>(

View file

@ -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.

View file

@ -1738,7 +1738,7 @@ class Navigator extends StatefulWidget {
BuildContext context,
String routeName, {
Object? arguments,
}) {
}) {
return Navigator.of(context).pushNamed<T>(routeName, arguments: arguments);
}
@ -1950,7 +1950,7 @@ class Navigator extends StatefulWidget {
String routeName, {
TO? result,
Object? arguments,
}) {
}) {
return Navigator.of(context).popAndPushNamed<T, TO>(routeName, arguments: arguments, result: result);
}
@ -1981,11 +1981,11 @@ class Navigator extends StatefulWidget {
/// {@end-tool}
@optionalTypeArgs
static String restorablePopAndPushNamed<T extends Object?, TO extends Object?>(
BuildContext context,
String routeName, {
TO? result,
Object? arguments,
}) {
BuildContext context,
String routeName, {
TO? result,
Object? arguments,
}) {
return Navigator.of(context).restorablePopAndPushNamed<T, TO>(routeName, arguments: arguments, result: result);
}
@ -2086,11 +2086,11 @@ class Navigator extends StatefulWidget {
/// {@end-tool}
@optionalTypeArgs
static String restorablePushNamedAndRemoveUntil<T extends Object?>(
BuildContext context,
String newRouteName,
RoutePredicate predicate, {
Object? arguments,
}) {
BuildContext context,
String newRouteName,
RoutePredicate predicate, {
Object? arguments,
}) {
return Navigator.of(context).restorablePushNamedAndRemoveUntil<T>(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<NavigatorState>() ?? 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) {

View file

@ -96,10 +96,10 @@ class ScrollAwareImageProvider<T extends Object> extends ImageProvider<T> {
// 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.

View file

@ -1345,12 +1345,12 @@ class RawScrollbarState<T extends RawScrollbar> extends State<T> 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<T extends RawScrollbar> extends State<T> with TickerProv
gestures[_TrackTapGestureRecognizer] =
GestureRecognizerFactoryWithHandlers<_TrackTapGestureRecognizer>(
() => _TrackTapGestureRecognizer(
() => _TrackTapGestureRecognizer(
debugOwner: this,
customPaintKey: _scrollbarPainterKey,
),
(_TrackTapGestureRecognizer instance) {
(_TrackTapGestureRecognizer instance) {
instance.onTapDown = _handleTrackTapDown;
},
);

View file

@ -336,8 +336,8 @@ class LogicalKeySet extends KeySet<LogicalKeyboardKey> with Diagnosticable
@override
String debugDescribeKeys() {
final List<LogicalKeyboardKey> sortedKeys = keys.toList()..sort(
(LogicalKeyboardKey a, LogicalKeyboardKey b) {
final List<LogicalKeyboardKey> 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<LogicalKeyboardKey> with Diagnosticable
return 1;
}
return a.debugName!.compareTo(b.debugName!);
},
);
});
return sortedKeys.map<String>((LogicalKeyboardKey key) => key.debugName.toString()).join(' + ');
}