mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Pointer events: Allow hover events from trackpad (#108116)
This commit is contained in:
parent
fc3471fd28
commit
c8a4c8b8a7
@ -1035,10 +1035,7 @@ class PointerHoverEvent extends PointerEvent with _PointerEventDescription, _Cop
|
||||
super.tilt,
|
||||
super.synthesized,
|
||||
super.embedderId,
|
||||
}) : // Dart doesn't support comparing enums with == in const contexts yet.
|
||||
// https://github.com/dart-lang/language/issues/1811
|
||||
assert(!identical(kind, PointerDeviceKind.trackpad)),
|
||||
super(
|
||||
}) : super(
|
||||
down: false,
|
||||
pressure: 0.0,
|
||||
);
|
||||
@ -1156,7 +1153,9 @@ class PointerEnterEvent extends PointerEvent with _PointerEventDescription, _Cop
|
||||
super.down,
|
||||
super.synthesized,
|
||||
super.embedderId,
|
||||
}) : assert(!identical(kind, PointerDeviceKind.trackpad)),
|
||||
}) : // Dart doesn't support comparing enums with == in const contexts yet.
|
||||
// https://github.com/dart-lang/language/issues/1811
|
||||
assert(!identical(kind, PointerDeviceKind.trackpad)),
|
||||
super(
|
||||
pressure: 0.0,
|
||||
);
|
||||
|
||||
@ -844,6 +844,17 @@ void main() {
|
||||
expect(event.synthesized, empty.synthesized);
|
||||
});
|
||||
});
|
||||
|
||||
test('Ensure certain event types are allowed', () {
|
||||
// Regression test for https://github.com/flutter/flutter/issues/107962
|
||||
expect(const PointerHoverEvent(kind: PointerDeviceKind.trackpad), isNotNull);
|
||||
|
||||
// The test passes if it compiles.
|
||||
});
|
||||
|
||||
test('Ensure certain event types are not allowed', () {
|
||||
expect(() => PointerDownEvent(kind: PointerDeviceKind.trackpad), throwsAssertionError);
|
||||
});
|
||||
}
|
||||
|
||||
void _expectTransformedEvent({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user