improve player gesture

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-05-14 10:56:37 +08:00
parent 2f12e1a1c0
commit 025775d231
2 changed files with 61 additions and 14 deletions

View File

@@ -0,0 +1,43 @@
import 'package:flutter/gestures.dart'
show
GestureRecognizer,
RecognizerCallback,
ScaleGestureRecognizer,
LongPressGestureRecognizer;
mixin PlayerGestureMixin on GestureRecognizer {
bool isPosAllowed = true;
@override
T? invokeCallback<T>(
String name,
RecognizerCallback<T> callback, {
String Function()? debugReport,
}) {
if (!isPosAllowed) return null;
return super.invokeCallback(name, callback, debugReport: debugReport);
}
}
class PlayerScaleGestureRecognizer extends ScaleGestureRecognizer
with PlayerGestureMixin {
PlayerScaleGestureRecognizer({
super.debugOwner,
super.supportedDevices,
super.allowedButtonsFilter,
super.dragStartBehavior,
super.trackpadScrollCausesScale,
super.trackpadScrollToScaleFactor,
});
}
class PlayerLongPressGestureRecognizer extends LongPressGestureRecognizer
with PlayerGestureMixin {
PlayerLongPressGestureRecognizer({
Duration? duration,
super.postAcceptSlopTolerance,
super.supportedDevices,
super.debugOwner,
super.allowedButtonsFilter,
});
}