Unverified Commit f6dc4db2 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

implicit-casts:false in flutter/lib/src/gestures (#45504)

* implicit-casts:false in flutter/lib/src/gestures

* address review comments
parent e766ae74
......@@ -632,7 +632,7 @@ class PointerAddedEvent extends PointerEvent {
orientation: orientation,
tilt: tilt,
transform: transform,
original: original ?? this,
original: original as PointerAddedEvent ?? this,
);
}
}
......@@ -694,7 +694,7 @@ class PointerRemovedEvent extends PointerEvent {
radiusMin: radiusMin,
radiusMax: radiusMax,
transform: transform,
original: original ?? this,
original: original as PointerRemovedEvent ?? this,
);
}
}
......@@ -799,7 +799,7 @@ class PointerHoverEvent extends PointerEvent {
tilt: tilt,
synthesized: synthesized,
transform: transform,
original: original ?? this,
original: original as PointerHoverEvent ?? this,
);
}
}
......@@ -907,7 +907,7 @@ class PointerEnterEvent extends PointerEvent {
down: event?.down,
synthesized: event?.synthesized,
transform: event?.transform,
original: event?.original,
original: event?.original as PointerEnterEvent,
);
@override
......@@ -945,7 +945,7 @@ class PointerEnterEvent extends PointerEvent {
down: down,
synthesized: synthesized,
transform: transform,
original: original ?? this,
original: original as PointerEnterEvent ?? this,
);
}
}
......@@ -1053,7 +1053,7 @@ class PointerExitEvent extends PointerEvent {
down: event?.down,
synthesized: event?.synthesized,
transform: event?.transform,
original: event?.original,
original: event?.original as PointerExitEvent,
);
@override
......@@ -1091,7 +1091,7 @@ class PointerExitEvent extends PointerEvent {
down: down,
synthesized: synthesized,
transform: transform,
original: original ?? this,
original: original as PointerExitEvent ?? this,
);
}
}
......@@ -1175,7 +1175,7 @@ class PointerDownEvent extends PointerEvent {
orientation: orientation,
tilt: tilt,
transform: transform,
original: original ?? this,
original: original as PointerDownEvent ?? this,
);
}
}
......@@ -1284,7 +1284,7 @@ class PointerMoveEvent extends PointerEvent {
platformData: platformData,
synthesized: synthesized,
transform: transform,
original: original ?? this,
original: original as PointerMoveEvent ?? this,
);
}
}
......@@ -1372,7 +1372,7 @@ class PointerUpEvent extends PointerEvent {
orientation: orientation,
tilt: tilt,
transform: transform,
original: original ?? this,
original: original as PointerUpEvent ?? this,
);
}
}
......@@ -1454,7 +1454,7 @@ class PointerScrollEvent extends PointerSignalEvent {
localPosition: PointerEvent.transformPosition(transform, position),
scrollDelta: scrollDelta,
transform: transform,
original: original ?? this,
original: original as PointerScrollEvent ?? this,
);
}
......@@ -1544,7 +1544,7 @@ class PointerCancelEvent extends PointerEvent {
orientation: orientation,
tilt: tilt,
transform: transform,
original: original ?? this,
original: original as PointerCancelEvent ?? this,
);
}
}
......@@ -341,7 +341,7 @@ class ForcePressGestureRecognizer extends OneSequenceGestureRecognizer {
// If the device incorrectly reports a pressure outside of pressureMin
// and pressureMax, we still want this recognizer to respond normally.
if (!value.isNaN)
value = value.clamp(0.0, 1.0);
value = value.clamp(0.0, 1.0) as double;
return value;
}
......
......@@ -142,7 +142,7 @@ class HitTestResult {
'matrix through PointerEvent.removePerspectiveTransform?'
'The provided matrix is:\n$transform'
);
_transforms.add(_transforms.isEmpty ? transform : transform * _transforms.last);
_transforms.add(_transforms.isEmpty ? transform : (transform * _transforms.last as Matrix4));
}
/// Removes the last transform added via [pushTransform].
......
......@@ -218,7 +218,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
return false;
}
}
return super.isPointerAllowed(event);
return super.isPointerAllowed(event as PointerDownEvent);
}
@override
......@@ -412,7 +412,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
assert(tracker != null);
DragEndDetails details;
void Function() debugReport;
String Function() debugReport;
final VelocityEstimate estimate = tracker.getVelocityEstimate();
if (estimate != null && isFlingGesture(estimate)) {
......
......@@ -264,7 +264,7 @@ class MouseTracker extends ChangeNotifier {
? LinkedHashSet<MouseTrackerAnnotation>.from(
annotationFinder(mouseState.mostRecentEvent.position)
)
: <MouseTrackerAnnotation>{};
: <MouseTrackerAnnotation>{} as LinkedHashSet<MouseTrackerAnnotation>;
_dispatchDeviceCallbacks(
currentState: mouseState,
......
......@@ -168,7 +168,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
return false;
}
}
return super.isPointerAllowed(event);
return super.isPointerAllowed(event as PointerDownEvent);
}
@override
......@@ -177,7 +177,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
if (!_firstTap.isWithinGlobalTolerance(event, kDoubleTapSlop)) {
// Ignore out-of-bounds second taps.
return;
} else if (!_firstTap.hasElapsedMinTime() || !_firstTap.hasSameButton(event)) {
} else if (!_firstTap.hasElapsedMinTime() || !_firstTap.hasSameButton(event as PointerDownEvent)) {
// Restart when the second tap is too close to the first, or when buttons
// mismatch.
_reset();
......@@ -190,7 +190,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
void _trackFirstTap(PointerEvent event) {
_stopDoubleTapTimer();
final _TapTracker tracker = _TapTracker(
event: event,
event: event as PointerDownEvent,
entry: GestureBinding.instance.gestureArena.add(event.pointer, this),
doubleTapMinTime: kDoubleTapMinTime,
);
......@@ -322,7 +322,7 @@ class _TapGesture extends _TapTracker {
Duration longTapDelay,
}) : _lastPosition = OffsetPair.fromEventPosition(event),
super(
event: event,
event: event as PointerDownEvent,
entry: GestureBinding.instance.gestureArena.add(event.pointer, gestureRecognizer),
doubleTapMinTime: kDoubleTapMinTime,
) {
......
......@@ -63,10 +63,8 @@ class Velocity {
@override
bool operator ==(dynamic other) {
if (other is! Velocity)
return false;
final Velocity typedOther = other;
return pixelsPerSecond == typedOther.pixelsPerSecond;
return other is Velocity
&& other.pixelsPerSecond == pixelsPerSecond;
}
@override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment